comms config
-
Hi I'm trying to write a class for serial comms. One of the things I want to do is to be able to set the config of the serial port using the
CommConfigDialog
API call, but I keep getting an exception in serialui.dll. I think I need to callGetCommConfig
first to get the pointer to the structure, but I can't work out how to get the size of the buffer (3rd parameter). Does anyone know how to do this? And also which buffer does it mean?BOOL GetCommConfig(
HANDLE hCommDev, // handle to communications service
LPCOMMCONFIG lpCC, // pointer to comm configuration structure
LPDWORD lpdwSize // pointer to size of buffer
);Thanks Andy
-
Hi I'm trying to write a class for serial comms. One of the things I want to do is to be able to set the config of the serial port using the
CommConfigDialog
API call, but I keep getting an exception in serialui.dll. I think I need to callGetCommConfig
first to get the pointer to the structure, but I can't work out how to get the size of the buffer (3rd parameter). Does anyone know how to do this? And also which buffer does it mean?BOOL GetCommConfig(
HANDLE hCommDev, // handle to communications service
LPCOMMCONFIG lpCC, // pointer to comm configuration structure
LPDWORD lpdwSize // pointer to size of buffer
);Thanks Andy
HANDLE hDev; HWND hWnd; COMMCONFIG cfg; DWORD dwSize = sizeof(cfg); GetCommConfig(hDev, &cfg, &dwSize); CommConfigDialog("name of device", hWnd, &cfg);
-
HANDLE hDev; HWND hWnd; COMMCONFIG cfg; DWORD dwSize = sizeof(cfg); GetCommConfig(hDev, &cfg, &dwSize); CommConfigDialog("name of device", hWnd, &cfg);
Brilliant cheers :-) my next question is about the pointer to the window hWnd. How can I get a pointer to whichever dialogue creates an instance of my serial port class? e.g. I have a communications dialogue and I want to get a handle to this but using my serial port class, but make it flexible so that it is not restricted to one dialogue? Thanks Andrew
-
Brilliant cheers :-) my next question is about the pointer to the window hWnd. How can I get a pointer to whichever dialogue creates an instance of my serial port class? e.g. I have a communications dialogue and I want to get a handle to this but using my serial port class, but make it flexible so that it is not restricted to one dialogue? Thanks Andrew
It would be up to the class that creates an instance of your serial port class to provide a pointer to its window. Your serial port class cannot "reach out" and get this.
-
It would be up to the class that creates an instance of your serial port class to provide a pointer to its window. Your serial port class cannot "reach out" and get this.
Ok, so the Dialogue class could pass it's own pointer if I defined the interface to the config dialogue as something like
CComPort port;
port.config(hWndDialogue)but how do I get the handle to the dialogue window? THis is what I meant really in the first place, I thought about using
GetParent
on the Config dialogue , but I can't because I need to create it first! Sorry if this is a stupid question. Hope you can help Andy -
Ok, so the Dialogue class could pass it's own pointer if I defined the interface to the config dialogue as something like
CComPort port;
port.config(hWndDialogue)but how do I get the handle to the dialogue window? THis is what I meant really in the first place, I thought about using
GetParent
on the Config dialogue , but I can't because I need to create it first! Sorry if this is a stupid question. Hope you can help Andyandyg.101 wrote: CComPort port;port.config(hWndDialogue) but how do I get the handle to the dialogue window? hWndDialogue IS the handle to the dialog window. I'm assuming this only because you are using a variable-naming convention where 'h' most likely means handle.
-
andyg.101 wrote: CComPort port;port.config(hWndDialogue) but how do I get the handle to the dialogue window? hWndDialogue IS the handle to the dialog window. I'm assuming this only because you are using a variable-naming convention where 'h' most likely means handle.
-
ok, I have worked out that I needed to use the m_hWnd member of my dialogue doh! i.e. pass port.config(m_hWnd); How can i find out what member variables are in a class heirarchy? The base classes viewer seems to only show functions? Andy
Not sure. Are you talking about the ClassView tab in the Workspace window? I've never known it to NOT show all members of a class.
-
Not sure. Are you talking about the ClassView tab in the Workspace window? I've never known it to NOT show all members of a class.
-
Yes the class view shows the members you declare in your derived class, but I don't think it shows the member variables in the base classes i.e. CWnd member variables. Andy
Nor would you want it to. The Workspace window would be way too crowded then. Intellisense, however, will show you the complete list of whatever object you happen to be working on.
-
Nor would you want it to. The Workspace window would be way too crowded then. Intellisense, however, will show you the complete list of whatever object you happen to be working on.