Thanks xwb,
Sorry about not getting back earlier. Been real busy around here.
The USB200.h is not my file. I believe it's a Microsoft file. But I did find out what I did before. I had to add this line to the stdafx.h file:
#undef _MP
I don't remember where I got that answer. And I...
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 tried this and it says that I can't use the static keyword on a member function defined at file scope (error C2724).
Thanks,
HyperEngineer
If it ain't broke, it probably needs improvement.
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...
Thanks Salem. That's what I was doing. In another class that was called from the main class, I was doing strange things with strtok_s(). And the program didn't like it.
buff = GetCommandLine();
token = strtok_s(buff, &seps1, &next_token);
sprintf_s(buff, 128, "%s", next_token);
token =...
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...
Using the ClearCommError() I peeked into the rcv buffer. There were 50 bytes. Originally, I thought I was only getting 32, but there actually is 50 bytes. But the ReadFile() function still can't read the port.
HyperEngineer
If it ain't broke, it probably needs improvement.
Greg,
Thanks for the input, but the timeouts are not necessary in overlapped mode. I'm only getting back 32 bytes and I have the buffers set for 256 bytes. I should be OK there. I know that the data gets to the port. If I put HyperTerminal on it, all the data is recovered. I have to be...
Hi Greg,
The WaitForSingleObject() does not return immediately. It times out. In this case it waits 10 seconds.
The third parameter of the CreateEvent() sets the event to the non-signalled state. I believe when I call the ReadFile() function it sets the event to the non-signalled state...
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 =...
There are two forms for the GetDlgItem(). One has one argument and the other has two. But I need the handle of a dialog box first. That is the scanCode handle. Then I could use this to get the handle of the text box control, possibly. But I can't seem to figure out how to get the handle of...
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 figured it out. It works fine. I opened app.vcproj instead of app.sln. I started a new project, seen what was there, then reopened the app project with .sln instead of .vcproj. Not sure what the differences are, but I won't make that mistake again.
HyperEngineer
If it ain't broke, it...
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...
If you want to do it at design time, click on the MSComm control you want to be the first one. Pull up the Properties window. Look for the (Name) property and make it what you want. In this case MSComm1. Then go down the Properties list until you see Index. Make this value 0. Now click on...
Rich,
When you set the index property to 0 you created and array. In your code you will have to use:
...
MSComm1(0).OnComm
...
If you don't use the index for MSComm1 it will give an error that there is the wrong number of arguments.
HyperEngineer
If it ain't broke, it...
Thanks for the reply xwb.
I did look at the bind function in MSDN. And I did assign the values to the sockaddr_in structure. But when I try to bind I get the WSAEADDRNOTAVAIL error. Here is the code:
CSocketDx::CSocketDx(void* arglist)
{
m_TelnetPort = (CTelnetGeneric*) arglist...
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.