I created a new project in VC2008. I added nothing to the code except these statements:
extern "C" {
#include <usb.h>
#include <usbiodef.h>
#include <usbioctl.h>
#include <usbprint.h>
#include <setupapi.h>
#include <devguid.h>
#include <wdmguid.h>
#include <InitGuid.h>
}
/*
This define is...
I have an application that starts a thread. In that thread I open a dialog box in modal mode. Then I try to update a Static control. Here are some code snippets.
This is in the main dialog:
CTest Test;
hTestSequenceThread = (HANDLE)_beginthread(Test.TestSequencer, 0, (void*)this);
This is...
I want to start a thread then write back to the main dialog to show the progress. It gets lost on the SetWindowText() function. Don't know where it goes. Here is the code:
This is in the header file:
static unsigned int __stdcall TestProgressTimer(void* arglist);
This is the button that...
I am using VC++ 2008. I am using MessageBox to give error info to the user. The code compiles fine. But when I run the program it will crash when it tries to display the MessageBox. (I tried MessageBox("This is an error"); MessageBox(_T("This is an error")); AfxMessageBox("This is an...
If I use "com3:" for the filename in CreateFile() I get a legitimate handle. If I use "\\.\com3" for the filename in CreateFile() I get an invalid handle value. I'm using VC2008 Standard edition. I thought I could use either one of these filenames.
HyperEngineer
If it ain't broke, it...
I'm having a problem reading from the comm port. It is Com3:. When trying to read from the serial port the WaitForSingleObject() times out. Any ideas?
Here is my code snipet.
HANDLE hCAN;
char CAN_Port[64];
DCB dcb;
OVERLAPPED olwrite = { 0 },
olread = { 0 },
olstatus =...
I'm trying to subclass two edit boxes from a dialog box that is not the main dialog box.
CEditCode::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CScan_SN_DLG* scanCode; // dialog with two text boxes
CAppDlg* AppVar; // main app dialog
// need to get variables from main...
I am using Visual Studio 2008 Standard. The OnChar() function for the dialog box does not exectute. I have two edit boxes and some buttons on the dialog box. How do I get the dialog box itself to have the focus so that the OnChar() function for the dialog box executes? Otherwise, I will have...
I've developed programs in C++ in Visual Studio 6. I know how to view a dialog box. Now I'm at a new company and have been given Visual Studio 2008 standard. Also, I have been given a project. I can see all the files in the Solutions Explorer. I can also see the classes. But I haven't been...
I've got a question. Can I bind a socket to a specific NIC so that when I send and receive it communicates to devices connected to that NIC only?
Any help would be appreciated, even if to say it can't be done.
HyperEngineer
If it ain't broke, it probably needs improvement.
I have a DLL that has one class that instantiates two other classes that use BeginThread(). It seems that the two new threads just stop processing. Here is some of the code.
The calling class:
This instantiates the classes:
msg = (char*) malloc(128);
sprintf(msg, "Socket = %d\n"...
This is a strange problem. If I run the VB6 program from the IDE it generates a run time error 49, bad DLL calling convention. However, if I compile the VB6 program and run the .exe file it does not generate the error.
The VB declare statement in a module:
Public Declare Function...
I have a Regular DLL with MFC with an exported function. When I call this function from a VB program it gives the error 453 can't find entry point in the DLL. I have this code in the .h file:
#define DLLexport __declspec(dllexport)
#ifdef __cplusplus
extern "C"
{
#endif
DLLexport int...
I'm having a problem with the recv() function hanging on me. If I call the recv() function with no flags it will hang there until data has arrived. So I put another recv() call with the MSG_PEEK flag, but it hangs. I don't know what is happening. Here is the program snippet that uses the...
Here's my problem. I have a button called Send. The OnSend functions works fine from within a procedure. But when I click on it, I get an error. Here is the code in the function.
void CTelnetDlg::OnGetData()
{
// TODO: Add your control notification handler code here
int iRet, iCount =...
I have a MFC project in VC++ 6. I have added the following files to the project.
AuxillaryFunctions.cpp:
// AuxillaryFunctions.cpp : Global functions for any project
//
#include "AuxillaryFunctions.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW...
How do you set a button control to disable. I can see in this property at design time, but can't seem to find how to access it at run time. When the button is clicked, I would like to disable it so that the user can't click it again. Is this possible? Or do I have to do it with flags...
How do I get the handle of the main dialog box. I can't seem to use m_pMainWnd anywhere. If I do the compiler complains that it is an undeclared identifier. In the dialog project I have essentially:
MyApp
MyAppDlg
MyOtherClasses
I need to access the MyAppDlg from MyOtherClasses to...
I have the following code in a class:
bool CTelnetDlg::ErrorMessage(CString cError)
{
m_cErrorStatus = cError;
UpdateData(false);
return 0;
}
When I call this code from within the class it works fine. But if I call it from another class the UpdateData(false); gives me an error.
Code...
I want to disable the OnComm event of a serial port. This is what I tried.
lResult = SetCommMask(MyComm.CommID, 0&)
lResult = GetCommMask(MyComm.CommID, lCommEvent)
In both statements lResult came back as 1. This is OK. However, the lCommEvent came back as 509. And the OnComm event...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.