|
Hello,
I am in the process of implementing a serial interface in my existing Visual C++ project by using the CSerialWnd functions as described in great detail in Ramon de Klein's contributed source code:
http://www.codeproject.com/system/serial.asp
I am able to perform the CSerialWnd::Open function on the COM1 port, and then expect to receive window notifications back in my main windows notification handler routine. I'm not a veteran Windows programmer so I may not have all the terminology exactly right. The call that I use to set that up is as follows:
lLastError = serial.Open ("COM1", hdlg, WM_NULL, 0, 2048, 2048);
if (lLastError != ERROR_SUCCESS)
here(0,"Error opening serial port");
lLastError = serial.Setup(CSerial::EBaud38400,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);
if (lLastError != ERROR_SUCCESS)
here(0,"Error opening serial port");
lLastError = serial.SetupHandshaking(CSerial::EHandshakeSoftware);
if (lLastError != ERROR_SUCCESS)
here(0,"Error opening serial port");
lLastError = serial.SetupReadTimeouts(CSerial::EReadTimeoutNonblocking);
if (lLastError != ERROR_SUCCESS)
here(0,"Error opening serial port");
I have run this code in debug and verify that I can indeed open the COM1 port. When I had another application using the port the code would detect the error. Passing in WM_NULL as the 3rd parameter in the Open should cause Windows to use the default notification message number of CSerialWnd::mg_nDefaultComMsg. When I looked through the include files I never found an exact definition of what this was. That was how I intended to determine which messages in my notification handler came from the serial interface thread that gets created by the Open. I decided to step through the code and came across this section where it gets assigned:
long lLastError = CSerialEx::Open(lpszDevice,dwInQueue,dwOutQueue);
if (lLastError != ERROR_SUCCESS)
return lLastError;
// Save the window handle, notification message and user message
m_hwndDest = hwndDest;
m_nComMsg = nComMsg?nComMsg:mg_nDefaultComMsg;
m_lParam = lParam;
// Start the listener thread
lLastError = StartListener();
When I looked at m_nComMsg it has a value of 49839 after it gets set. The problem is, when I look at all the messages coming into my notification handler I don't have any that are 49839. There are lots of messages coming in that I believe are the result of my sending a couple "hello world" messages into the Windows program. But they have message ID's of like 307,309,312.
I started trapping all messages coming into the notification window and time stamping them. Before and after sending the "hello world" serial data in, I hit a button twice that causes the 1006 LOWORD value of wParam. I did this to make it easy to see where exactly I should have been seeing the serial data notifications. Below is the diagnostic notification information. I will only include one of the preceding and trailing 1006 messages to keep it short:
dlg Msg 149 is 273 WM_COMMAND hiword wParam = 0 loword wParam = 1006 at time Feb 3, 2004 2:54:40 PM 551 ms
dlg Msg 150 is 160 hiword wParam = 0 loword wParam = 18 at time Feb 3, 2004 2:54:41 PM 520 ms
dlg Msg 151 is 134 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 152 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 153 is 6 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 154 is 28 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 155 is 309 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 156 is 70 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 157 is 28 hiword wParam = 0 loword wParam = 1 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 158 is 134 hiword wParam = 0 loword wParam = 1 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 159 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 160 is 6 hiword wParam = 0 loword wParam = 1 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 161 is 309 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 162 is 309 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:42 PM 379 ms
dlg Msg 163 is 134 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 520 ms
dlg Msg 164 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:42 PM 520 ms
dlg Msg 165 is 6 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 520 ms
dlg Msg 166 is 28 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:42 PM 520 ms
dlg Msg 167 is 309 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:42 PM 535 ms
dlg Msg 168 is 309 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:42 PM 535 ms
dlg Msg 169 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 488 ms
dlg Msg 170 is 133 hiword wParam = 18692 loword wParam = 3958 at time Feb 3, 2004 2:54:44 PM 488 ms
dlg Msg 171 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 488 ms
dlg Msg 172 is 20 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:44 PM 488 ms
dlg Msg 173 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 520 ms
dlg Msg 174 is 133 hiword wParam = 41476 loword wParam = 2319 at time Feb 3, 2004 2:54:44 PM 520 ms
dlg Msg 175 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 520 ms
dlg Msg 176 is 20 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 520 ms
dlg Msg 177 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 551 ms
dlg Msg 178 is 133 hiword wParam = 51972 loword wParam = 706 at time Feb 3, 2004 2:54:44 PM 551 ms
dlg Msg 179 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 551 ms
dlg Msg 180 is 20 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:44 PM 551 ms
dlg Msg 181 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 582 ms
dlg Msg 182 is 133 hiword wParam = 43012 loword wParam = 1679 at time Feb 3, 2004 2:54:44 PM 582 ms
dlg Msg 183 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 582 ms
dlg Msg 184 is 20 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:44 PM 582 ms
dlg Msg 185 is 310 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:44 PM 582 ms
dlg Msg 186 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 582 ms
dlg Msg 187 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 598 ms
dlg Msg 188 is 133 hiword wParam = 22276 loword wParam = 1619 at time Feb 3, 2004 2:54:44 PM 598 ms
dlg Msg 189 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 598 ms
dlg Msg 190 is 20 hiword wParam = 15617 loword wParam = 2752 at time Feb 3, 2004 2:54:44 PM 598 ms
dlg Msg 191 is 310 hiword wParam = 15617 loword wParam = 2752 at time Feb 3, 2004 2:54:44 PM 598 ms
dlg Msg 192 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 598 ms
dlg Msg 193 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 613 ms
dlg Msg 194 is 133 hiword wParam = 57092 loword wParam = 2516 at time Feb 3, 2004 2:54:44 PM 613 ms
dlg Msg 195 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 613 ms
dlg Msg 196 is 20 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 613 ms
dlg Msg 197 is 310 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 613 ms
dlg Msg 198 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 613 ms
dlg Msg 199 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 645 ms
dlg Msg 200 is 133 hiword wParam = 37380 loword wParam = 1673 at time Feb 3, 2004 2:54:44 PM 645 ms
dlg Msg 201 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 645 ms
dlg Msg 202 is 20 hiword wParam = 10241 loword wParam = 2466 at time Feb 3, 2004 2:54:44 PM 645 ms
dlg Msg 203 is 310 hiword wParam = 10241 loword wParam = 2466 at time Feb 3, 2004 2:54:44 PM 645 ms
dlg Msg 204 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 645 ms
dlg Msg 205 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 660 ms
dlg Msg 206 is 133 hiword wParam = 10244 loword wParam = 1627 at time Feb 3, 2004 2:54:44 PM 660 ms
dlg Msg 207 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 660 ms
dlg Msg 208 is 20 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 660 ms
dlg Msg 209 is 310 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 660 ms
dlg Msg 210 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 660 ms
dlg Msg 211 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 692 ms
dlg Msg 212 is 133 hiword wParam = 30468 loword wParam = 2214 at time Feb 3, 2004 2:54:44 PM 692 ms
dlg Msg 213 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 692 ms
dlg Msg 214 is 20 hiword wParam = 10241 loword wParam = 2466 at time Feb 3, 2004 2:54:44 PM 692 ms
dlg Msg 215 is 310 hiword wParam = 10241 loword wParam = 2466 at time Feb 3, 2004 2:54:44 PM 692 ms
dlg Msg 216 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 692 ms
dlg Msg 217 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 707 ms
dlg Msg 218 is 133 hiword wParam = 38916 loword wParam = 1750 at time Feb 3, 2004 2:54:44 PM 707 ms
dlg Msg 219 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 707 ms
dlg Msg 220 is 20 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 707 ms
dlg Msg 221 is 310 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 707 ms
dlg Msg 222 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 707 ms
dlg Msg 223 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 770 ms
dlg Msg 224 is 133 hiword wParam = 40964 loword wParam = 1627 at time Feb 3, 2004 2:54:44 PM 770 ms
dlg Msg 225 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 770 ms
dlg Msg 226 is 20 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 770 ms
dlg Msg 227 is 310 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 770 ms
dlg Msg 228 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 770 ms
dlg Msg 229 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 801 ms
dlg Msg 230 is 133 hiword wParam = 33284 loword wParam = 2319 at time Feb 3, 2004 2:54:44 PM 801 ms
dlg Msg 231 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 801 ms
dlg Msg 232 is 20 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:44 PM 801 ms
dlg Msg 233 is 310 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:54:44 PM 801 ms
dlg Msg 234 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 801 ms
dlg Msg 235 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 879 ms
dlg Msg 236 is 133 hiword wParam = 12804 loword wParam = 1158 at time Feb 3, 2004 2:54:44 PM 879 ms
dlg Msg 237 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 879 ms
dlg Msg 238 is 20 hiword wParam = 10241 loword wParam = 2466 at time Feb 3, 2004 2:54:44 PM 879 ms
dlg Msg 239 is 310 hiword wParam = 10241 loword wParam = 2466 at time Feb 3, 2004 2:54:44 PM 879 ms
dlg Msg 240 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 879 ms
dlg Msg 241 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 895 ms
dlg Msg 242 is 133 hiword wParam = 46852 loword wParam = 2516 at time Feb 3, 2004 2:54:44 PM 895 ms
dlg Msg 243 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 895 ms
dlg Msg 244 is 20 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:54:44 PM 895 ms
dlg Msg 245 is 310 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:54:44 PM 895 ms
dlg Msg 246 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 895 ms
dlg Msg 247 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:54:44 PM 957 ms
dlg Msg 248 is 133 hiword wParam = 55300 loword wParam = 2516 at time Feb 3, 2004 2:54:44 PM 957 ms
dlg Msg 249 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:54:44 PM 957 ms
dlg Msg 250 is 20 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 957 ms
dlg Msg 251 is 310 hiword wParam = 42497 loword wParam = 4230 at time Feb 3, 2004 2:54:44 PM 957 ms
dlg Msg 252 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:54:44 PM 957 ms
dlg Msg 253 is 136 hiword wParam = 0 loword wParam = 4 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 254 is 133 hiword wParam = 36868 loword wParam = 3958 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 255 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 256 is 20 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 257 is 310 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 258 is 70 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 259 is 28 hiword wParam = 0 loword wParam = 1 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 260 is 134 hiword wParam = 0 loword wParam = 1 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 261 is 13 hiword wParam = 0 loword wParam = 510 at time Feb 3, 2004 2:55:01 PM 832 ms
dlg Msg 262 is 6 hiword wParam = 0 loword wParam = 1 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 263 is 309 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 264 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 265 is 15 hiword wParam = 0 loword wParam = 0 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 266 is 309 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 267 is 309 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 268 is 307 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 269 is 307 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 270 is 311 hiword wParam = 61185 loword wParam = 1563 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 271 is 312 hiword wParam = 42497 loword wParam = 2229 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 272 is 78 hiword wParam = 0 loword wParam = 1000 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 273 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 274 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 275 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 276 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 277 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 278 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 279 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 280 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 281 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 282 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 283 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 284 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 285 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 286 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 287 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 288 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 289 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 290 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 291 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 292 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 293 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 294 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 295 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 296 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 297 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 298 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 299 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 300 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 301 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 302 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 303 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 304 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 305 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 306 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 307 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 308 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 309 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 310 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 311 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 312 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 313 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 314 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 315 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 316 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 317 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 318 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 319 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 320 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 321 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 322 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 323 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 324 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 325 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 326 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 327 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 328 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 329 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 330 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 331 is 312 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 332 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 333 is 307 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:01 PM 848 ms
dlg Msg 334 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:01 PM 910 ms
dlg Msg 335 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 004 ms
dlg Msg 336 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 113 ms
dlg Msg 337 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 207 ms
dlg Msg 338 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 301 ms
dlg Msg 339 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 301 ms
dlg Msg 340 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 332 ms
dlg Msg 341 is 160 hiword wParam = 0 loword wParam = 2 at time Feb 3, 2004 2:55:02 PM 348 ms
dlg Msg 342 is 33 hiword wParam = 33 loword wParam = 3652 at time Feb 3, 2004 2:55:10 PM 317 ms
dlg Msg 343 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:10 PM 317 ms
dlg Msg 344 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:10 PM 410 ms
dlg Msg 345 is 309 hiword wParam = 23809 loword wParam = 2460 at time Feb 3, 2004 2:55:10 PM 426 ms
dlg Msg 346 is 273 WM_COMMAND hiword wParam = 0 loword wParam = 1006 at time Feb 3, 2004 2:55:10 PM 426 ms
I pushed a button on the GUI that caused the 1006 notification at 2:54:40, the 2 serial strings were sent in at 2:54:50 and 2:55:00. The next 1006 button push was done at 2:55:10. As you can see, the 1006 notifications came in almost exactly when they should have. The data between that reflects the serial data do not appear at 2:54:50 and 2:55:00.
The main question that I have though, is why don't the serial interface notifications have a dialog message type of 49839 like I expect. Also, the different types of serial message notifications are supposed to come in as the LOWORD of wParam. This is an enumerated type defined in WinBase.h where received data is a 1, sent data complete is 4, break received is 64, etc. But the data that I am getting in wParam is nothing like these, even if you account for the fact that multiple bits might be set at the same time.
I did find another example of a similar implementation at this web page:
http://www.icculus.org/~lucasw/School%20Projects/478/PCinterface/ffconst.cpp
Any help would be greatly appreciated. As I mentioned I am not a Windows programmer. My background is real time single board computer embedded systems using vxWorks. The learning curve is pretty steep for the Visual C++ GUI code.
Robert
|
|
|
|
|
Just wanted to let you all know that I figured out the problem in case someone comes upon this thread in the future. The problem that I was having is that my declaration:
CSerialWnd serial;
Was located in the InitDialogProc routine which would get called from the main dialog processing routine upon receipt of the WM_INITDIALOG notification. I moved that declaration to be global and I started receiving serial notifications in the main dialog processing routine. Now I will be able to write the code that handles the serial data stream.
Good Luck,
Robert
|
|
|
|
|
Hi,
I am using Visula C++ 6.0. I want to print a document to a printer. But I want to print to using a specific paper tray of the printer. I can not user prinet dialog, as I want to add this code in a service application.
Thanks
Asawari
Asawari
|
|
|
|
|
You'll need to setup the DEVMODE struct to point to the paperbin that you want to use. See MSDN and search for DEVMODE.
onwards and upwards...
|
|
|
|
|
Hi,
I want to filter all the windows messages to my MFC application before dispatching them to the main window or its child windows. I decided to override the PreTranslateMessage of my main application (CWinApp) to filter these messages. It works fine for the main frame window, menu, etc. I can capture all the mouse clicks, key presses, etc on the main frame, and its child dialog windows.
However, if my customized dialog classes are inherited from CFileDialog, CPageSetupDialog, CPrintDialog, etc, (all those subclasses of CCommonDialog), the PreTranslateMessage will not capture the messages for
these types of dialogs. It seems only work when my dialog classes are inherited from CDialog directly.
Does any one know how to fix this ? I don't want to add specific event handlers to each of these dialogs cause i don't to duplicate my filter code everywhere. Thanks for your help in advance.
Best Regards,
Benny Levin
|
|
|
|
|
Check who the parent or owner window of the common subclassed dialogs is. Maybe it is the desktop (NULL?) and not your app. You may need to add a PreTranslateMessage() to your dialogs.
Windows hooks are another way to do this sort of thing.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
That's works for "normal" MFC dialog because MFC doesn't use a DialogBoxXX api, but CreateDialog instead + message loop, thus allowing PreTranlsateMessage work. Of course it doesn't work if the dialogs created with DialogBoxXX (like common dialogs) as well as message boxes, MFC don't control message loop in those functions.
message hooks should help
Edward
|
|
|
|
|
Here's what I've got:
CDatabase DataBase;
TRY
{
DataBase.OpenEx(_T("DSN=test;UID=;PWD="),CDatabase::noOdbcDialog);
}
CATCH(CDBException,e)
{
#ifdef _DEBUG
MessageBox("ERROR Connecting");
#endif
}
END_CATCH
TRY
{
DataBase.ExecuteSQL("INSERT INTO Annotation (AnnotationID,ImageID,Text) VALUES ('1','2','Capsule')");
}
CATCH(CDBException,e)
{
#ifdef _DEBUG
MessageBox("ERROR Inserting");
#endif
}
END_CATCH
It appears to be connecting fine, but I always get "ERROR Inserting". 'Annotation' is the table I'm trying modify fields in. When I set up my DSN, I put the default database to the one that the table 'Annotation' is in (instead of master or model, etc). What am I doing wrong or failing to do?
halblonious
|
|
|
|
|
Taking a look at e->m_strError to see what the error is seems like a logical first step
|
|
|
|
|
I never even knew to check that. Sadly, though, it doesn't really tell me much. Do you know of a good place to find prototype syntax for this stuff? What I had works for modifying an Access database, but doesn't seem to work on SQL.
halblonious
|
|
|
|
|
could you post the error message?
|
|
|
|
|
At a guess, AnnotationID and ImageID are numeric (integer?) types. Try removing the quoting around them so it's just
VALUES(1,2,'Capsule')
Of course, there may also be uniqueness constraints which stop you inserting the same values more than once...
Steve S
|
|
|
|
|
Has anybody ever noticed that when you compile C++ programs/files that you can use the browse info to locate any and all references of structure elements (in addition to classes, of course), but for C programs/files, the only browse info available for structure elements is the declaration of the struct element?
This is something that has plagued me for several years (over several versions of MSVC), as my work involves a mix of C and C++ programming. I have spent a fair amount of time searching the web for any clues on why this might be or what settings I can change to get the struct element references in my browse info for C programs. I can't seem to find anything or even anybody else even asking the question.
I have found one work-around to be to compile with /TP, which forces C++ compilation. However, this is not a good work-around, because the files are really C files and compiling as C++ produces many errors (many are legacy files which I cannot modify at my whim).
Am I the only person in the world who has missed this capability for C programs? Has anybody ever figured out how to get this capability for C programs? Are there better tools out there for this?
Thanks,
Bob Farrell
|
|
|
|
|
Can someone please tell me how to obtain the Windows handle when you know the windows resource. Its a MFC application.
I need to pass the handle for a push button to another routine. The resource is IDC_TEST1.
I have been trying code snips like:
CWnd *pWnd = FindWindow( "IDC_TEST", NULL );
HWND hWnd = pWnd->GetSafeHwnd();
Note it is the hWnd that I require. The button class names is CHoverButton, but they are several on the dialog. How do I determine the handle for each HoverButton?
The window (Button1 for CHoverButton) is part of my application. I just need the handle to arrange for the resize action of Button1's window.
grahamfff
|
|
|
|
|
HWND hCtrl = GetDlgItem(IDC_TEST1);
INTP
|
|
|
|
|
You want to use: ::GetDlgItem( hDlg, IDC_TEST1); or GetDlgItem( IDC_TEST1); and test the returned handle of course.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Use the methods described in the previous replies. Or, if you are not calling this from the owning window, you can always use EnumChildWindows...
onwards and upwards...
|
|
|
|
|
hello,
So I have written a little application in VC++, and I access a dBase files via ODBC. My development machine has a Win2k OS. I copy all .dbf and all .dbt files from my machine to another one with a WinXP OS.
When I start my application on both machines, I have discrepencies in the number of records returned by my SELECT statement even if the files are totally identical :
it seems than I receive deleted records on the XP machine. When I look at table used with FoxPro on my Win2k machine,all extra records have a black square -I assume this means deleted row? - at the beginning of the row) and that these deleted records are not returned on Win2k machine ...
1) does it look like an already known problem ?
2) on Win2k machine, the MSJET40.dll must be issued from a SP5 when i look at its version#: I wanted to upgrade it to the latest version SP8, but when I try to launch the upgrade exe, I receive an error message that tells me that I must at least be with SP3 ... How is this check performed ?
3) Is there a difference between MSJET on Win2k and winXP ?
Any information or solution is welcome ...
DD
|
|
|
|
|
Most likely the difference is due to the ODBC DSN settings. The Advanced options allow for inclusion or exclusion of deleted records. Check your DSN settings and make sure that they are identical on both machines.
onwards and upwards...
|
|
|
|
|
Hello,
yes, how stupid I am !!
you are totally right, I modified this option on my Win2k station and forget to say to do so when configuring the WinXP station.
Thanks
DD
|
|
|
|
|
My application (Windows service) should wait for new XML files arriving in a specified directory (those files are uploaded there by EXTERNAL FTP process) and process them. To do this I use notification mechanism based on "ReadDirectoryChangesW" API with "FILE_NOTIFY_CHANGE_FILE_NAME" flag. After receiving a new notification and filtering out everything except for "FILE_ACTION_ADDED" one, I start file processing (having a name of newly created file from notification) with MSXML parser.
And here's the problematic place:
If arriving XML file is big enough and "IXMLDOMDocument:load()" method gets called (from notification handler) before file is written down to the disk completelly, this call to load() method fails to complete the operation in the following ways:
- If "async" property of XMLDOMDocument was set to "FALSE", it just returns "FALSE" as a result.
- If "async" property was set to be "TRUE" - it returns immediatelly with TRUE, but every subsequent call to XMLDOMDocument (to getelement or whatever) fails with E_PENDING result. I tried to use "onreadychangestate" event notification mechanism to handle this asyncronous loading, but it always receives only "LOADING", "LOADED" and "INTERACTIVE" (1, 2 and 3) state change notifications and never receives "COMPLETED" (4) notification (and as a result it never lets me call any other methods on the document successfully).
Question(s):
1) is there any way to correctly handle this "SUPER_ASYNCRONOUS" load behaviour at the level of MSXML object.
2) if 1-st option is not possible - is there any way to WAIT in notification handler for the file to be completelly written down to the disk (by external process) before calling MSXML Document::load() method. Here I mean some "appropriate" solution with WaitFor..., async I/O notification handler or something like this - NOT JUST "Sleep( 10000 )" and 100 more attempts to try to load() in a loop.
Andrey
|
|
|
|
|
Hi Andrey,
Isn't the problem that the FTP download hasn't necessarilly completed when you get the initial notification? If so is there a way to check when the file is closed and trigger your MSXML action then. Another option would be to check if any processes have the file open and wait untill none do. Finally monitor the file size and when it stops changing trigger the action. This would be the least reliable.
Hope that helps.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Neville,
that's absolutely right - notification about creation of the file arrives earlier than file is uploaded completelly. But I thought, setting "async" property of XMLDocument to be "TRUE" should handle this scenario (from what I read from Documentation). What I could see from "practice" is it handles correctly only parsing "asyncronously", assuming file was completely written on the disk before. So, I agree with your suggestions, actually I thought about something like this, but:
1) I do not think last option is reliable because it depends of flushing of I/O buffers and will take some tricks to implement (which I think might make it very vulnerable)
2) For 1-st and 2-nd options (which for me sound very similar) I was not able to find "details"/"appropriate Win32 API" how to implement it. The uploading process is external, so I do not have an ability to check directly if file handle was closed.
Indirectly -
Neville Franks wrote:
to check if any processes have the file open and wait untill none do
- what functionality should be used to do this - attempt to CreateFile() with SHARE_EXCLUSIVE mode untill success? Is there any way to wait for file to be released by other process in some "Win32 API Wait()-function"?
Now I see only this solution:
for( int i = 0; i < MAX_OPEN_ATTEMPTS; ++i )
{
bool bOpen = OpenFile( EXCLUSIVE_MODE );
if( bOpen )
break;
Sleep( 1000 );
}
which I do not like because of some hardcoded Sleep statements and possible multiple attempts to open a file in an exclusive mode?
Thank you very much for your responce and I would appreciate if you have any other suggestions/comments.
Best regards,
Andrey
|
|
|
|
|
Hi Andrey,
I can't comment on MSXML I'm afraid as I have never used it. I use pugXml here on CP. Bit that won't help with this problem.
Check for exclusive file access is the approach I would take. However for this to work you have to know whether the FTP process uses exclusive access otherwise this may not work.
If it does then I would simply launch a thread which waited untill it could get exclusive access, which hopefully indicates the FTP process has finished. The thread would then trigger the MSXML parse. I can recommend ThreadLibrary which I use in ED, amongst lots of other thread code. See: http://www.codeproject.com/threads/threadlibrary.asp[^]
If none of this works have a look over at: http://www.sysinternals.com[^] Filemon v6.07 and Handle v2.10
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
#include "stdafx.h"
char lpBuffer[256]
{
GetPrivateProfileString()
"FYP.doc", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpDefault - in case file does not exist this is default
lpBuffer, // LPCTSTR lpReturnedString
256, // DWORD nSize
"File.ini" // LPCTSTR lpFileName
WritePrivateProfileString()
"FYP.doc", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpString - whatever you want to save
"File.ini" // LPCTSTR lpFileName
}
return 0;
I got two error<br />
1)error C2239: unexpected token '{' following declaration of 'lpBuffer'<br />
2)error C2143: syntax error : missing ';' before 'return'<br />
<br />
Can someone help me debug these two error thanks
|
|
|
|
|