|
Did I miss something in the MSDN help files or what? I came to the conclusion that when accessing the serial port (using CreateFile) without overlapping that control remains on the process being performed on the serial port until it is completed (or timed out). The problem I am having is that when I attempt to read a response in from the serial port, its picking up part of the second to last write and all of the last write as well as the incoming data. Any suggestions welcome.
Of all things I've lost... I miss my mind the most
-mjf
|
|
|
|
|
In over 5 years of working with serial ports I have never seen CreateFile do that. However, that will happen when:
1. You are using a radio system.
2. Your remote device echos
3. Your serial line is one of those with only 1 T/R line so you get the cross talk.
This is actually very standard in communications and you will need to be able to ignore your own output.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Five years with serial ports... my hats off to you. Been kicked there and back trying to learn to use efficiently this last week. I am nearly ashamed to admit that I didn't realize the device's echo was causing my problem (guess I couldn't see the forest on account of all them trees). Do you have any suggetions as to how I can elimate the echo's just prior to reading the incoming data? If I could just write a little code to strip off the last write that would be good enough be I'm not in control of just what it will be (on account that diffent address's will be sending data and each requires a different (albliet slight) command (the Write).
Either way, thanks for your input... it never ceases to amaze me how a second pair of eyes can that which I cant, even when its right in front of me.
-Mel Feik
Of all things I've lost... I miss my mind the most
-mjf
|
|
|
|
|
will give me all key strokes on all child windows on a CFrameWnd derived class... i need to have capture function key strokes also and have the ability to decide whether they pass through or not
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Just a guess
Try looking into PreTranslateMessage()
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Thomas George wrote:
i need to have capture function key strokes also and have the ability to decide whether they pass through or not
I think you need OnKeyDown or PreTranslateMessage
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I do this using PreTranslateMessage().
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Hello,I need a full list of the windows hooks, could someone tell anything abaut this?
thanks
|
|
|
|
|
Anonymous wrote:
I need a full list of the windows hooks
That doesn't mean much IMO...
What do you mean a ful list of windows hooks...???
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
documentation here.
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Can you delete a toolbar icon from inside the Toolbar Resource Editor?
It seems the Resource Editor can only create them, but not remove them.
Thanks.
William
|
|
|
|
|
You can delete them. Just drag the button outside of the toolbar and drop it.
Shog9
------
No one's immune now, from a world of problems
No one's exempt now, from a world of pain
That's the way that it goes
when you're down here with the rest of us...
|
|
|
|
|
Thanks. I appreciate it.
William
|
|
|
|
|
Is there a way to do a bulk insert into an Access database that has no system DSN? I've created the DB on the fly with ADOX and now I want to be able to do a bulk insert using VC++. I know that there is a BULK INSERT command for SQL Server and I believe it is supposed to work with Access, however, I only see examples in the context of having a DSN defined. I just want to do so on the fly using a file path to the database. Any help would be greatly appreciated.
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I am trying to get a tooltip to show up for an entire window, not just a control. I know I am creating the window correctly, so I think it must be the values I am putting into the Toolinfo structure. If any one has any insight to what might be causeing the AddTool call to be failing I would appreciate it!
Here is my exact code of how I am doing it:
HWND hwndTT; // handle to the ToolTip control
TOOLINFO ti;// struct specifying info about tool in ToolTip control
WCHAR wszTTtext[]= L"This is your ToolTip string.";
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = hwnd;
ti.hinst = _Module.GetModuleInstance();
ti.uId = (UINT_PTR)hwnd;
ti.lpszText = (LPTSTR)wszTTtext;
// ToolTip control will cover the whole window
ti.rect.left = rect.left;
ti.rect.top = rect.top;
ti.rect.right = rect.right;
ti.rect.bottom = rect.bottom;
if(!SendMessage(hwndTT,TTM_ACTIVATE,(WPARAM)TRUE,0)){
WriteLog(_T(" > Could not Activate TooltipControl\r\n"));
}
/* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
if(!SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti)){
WriteLog(_T(" > Did not Create TooltipControl\r\n"));
}
|
|
|
|
|
I'm programming winsock. In my app i'm building in a feature for sending multiple files over the internet. In the filesend request i set up a loop where i send the filename and -size of the files the user has chosen to send. My problems is this: the second time the sender of the files calls the recv function to receive the "GETSIZE" string, then, instead of receiving "GETSIZE" it receives the "GETSIZE" string but shifted one place to the right, so it's actually "\0GETSIZE" without a terminating null but with a starting null instead. Here are the loops how they look on the sender's and the receiver's side.
Receiver's side:
<font face="Courier New" size=2>
char szTempChar[512];
DWORD dwTotalFileSize = 0;
char szFileName[MAX_PATH+1];
bool bStop = false;
char szRecvBuff[513];
i = send(sckClient, "GETFILENAME", 12, 0);
i = recv(sckClient, szRecvBuff, 512, 0);
while (bStop == false)
{
strcpy(szFileName, szRecvBuff);
i = send(sckClient, "GETSIZE", 8, 0);
i = recv(sckClient, szRecvBuff, 512, 0);
dwTotalFileSize = dwTotalFileSize + atoi(szRecvBuff);
sprintf(szTempChar, "%s, %s bytes\r\n", szFileName, szRecvBuff);
AddText(ghMultipleWnd, IDC_MULTIPLEFILENAMEREQUEST, szTempChar);
i = send(sckClient, "GETFILENAME", 12, 0);
i = recv(sckClient, szRecvBuff, 512, 0);
if (!strcmp(szRecvBuff, "\\DONE"))
bStop = true;}
}
</font>
and the sender's side (szCompleteFileName is an array of char * pointing to a string that is the path to one of the files the user wants to send. GetFileName is a function that strips the path away from the complete filename
<font face="Courier New" size=2>
HANDLE hCheckFile
char szTempChar[512];
DWORD dwCurrentFileSize = 0;
char szFileName[MAX_PATH+1];
bool bStop = false;
char szRecvBuff[513];
int iFileCount = 0;
DWORD dwCurrentFileSize = 0;
i = recv(sckClient, szRecvBuff, 12, 0);
while (iFileCount+1 <= SendMessage(GetDlgItem(ghWnd, IDC_FILES), LB_GETCOUNT, 0, 0))
{
if (!strcmp("GETFILENAME", szRecvBuff))
{
strcpy(szRecvBuff, szCompleteFileName[iFileCount++]);
GetFileName(szRecvBuff);
send(sckClient, szRecvBuff, strlen(szRecvBuff)+1, 0);
i = recv(sckClient, szRecvBuff, 8, 0);
if (!strcmp("GETSIZE", szRecvBuff))
{
if ((hCheckFile = CreateFile(szCompleteFileName[iFileCount], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != ERROR_SUCCESS)
dwCurrentFileSize = GetFileSize(hCheckFile, NULL);
else
dwCurrentFileSize = 0;
CloseHandle(hCheckFile);
sprintf(szRecvBuff, "%d", dwCurrentFileSize);
send(sckClient, szRecvBuff, strlen(szRecvBuff)+1, 0);
i = recv(sckClient, szRecvBuff, 12, 0);
}
}
}
</font>
The strange thing that happens is that the second time the sender's function runs the "i = recv(sckClient, szRecvBuff, 8, 0);" the result in the szRecvBuffer is "\0GETSIZE" without a termunating null. Now everytime the loop has run the string gets shifted one place to the right, so the second time the sender tried to receive "GETSIZE" it received "\0\0GETSIZ" and the same thing happens with the "GETFILENAME" it gets shifted one to the right afer each loop. I've beed fiddling with this for a long time now but can't figure it out, any ideas?
Thankyou
-Rune Svendsen
|
|
|
|
|
send(sckClient, "GETSIZE", 8, 0);
There are only 7 chars in this. I do not know what the behaviour will be in
this case.
you have to send a null character if you want it to go.
i would assume
send(sckClient, "GETSIZE", 7, 0);
would be more appropriate
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I believe the server and client are out sync. Use a diagram to plot your algorithm and make sure the server sends the exact size and the exact data; and the client receives the correct size and read the exact data.
Kuphryn
|
|
|
|
|
Hello!
How can I make to mark as selected the entire line on a CListCtrl Box.
When the first column was clicked, this was mark as selected, but I need that the line must be complete mark as selected like on a CListBox control.
Thanks.
Walote
|
|
|
|
|
Use the LVS_EX_FULLROWSELECT extended style:
pListCtrl->SetExtendedStyle(pListCtrl->GetExtendedStyle()|LVS_EX_FULLROWSELECT);
Shog9
------
No one's immune now, from a world of problems
No one's exempt now, from a world of pain
That's the way that it goes
when you're down here with the rest of us...
|
|
|
|
|
Thank you Shog9 for you answer, but I see another problem.
SetExtendedStyle and GetExtendedStyle is not supported for my compiler (Visual C++ 5.00), the style LVS_EX_FULLROWSELECT can not be found on the Help for this compiler. (Visual Studio C++ 5.00)
Must to be inserted a new class or any include file with the definition for this extended style.
Thank you again.
Walote
|
|
|
|
|
You may need to upgrade your version of Visual C++, or at least install the (free) Platform SDK. From my commctrl.h :
#define LVS_EX_FULLROWSELECT 0x00000020 // applies to report mode only Good luck!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
As Ravi stated, you should consider upgrading, or downloading the platform SDK. But for the moment, here's the info you need:
#define LVS_EX_FULLROWSELECT 0x20
#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+54)
#define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+55)
::SendMessage(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
(LPARAM) ::SendMessage(hWndList, LVM_GETEXTENDEDLISTVIEWSTYLE, 0,
0)|LVS_EX_FULLROWSELECT);
Shog9
------
No one's immune now, from a world of problems
No one's exempt now, from a world of pain
That's the way that it goes
when you're down here with the rest of us...
|
|
|
|
|
I don't know how to insert an icon into menu bar. In stead of showing the caption of item in menu bar, I want to show the icon to make it more beautiful.
Thank you for your reading.
Don't forget drop me some lines after reading.
|
|
|
|
|
DrawIcon() inside of DrawItem()
Make your menu item owner drawn and go nutts!!!
[edit]Your probably gonna wanna look at MeasureItem() also...[/edit]
Your not gonna need owner drawn if you just wanna have a small icon inside the menu item with normal text, just use bitmaps instead...and you'll have menus that look like VC++...Owner drawn is beautiful...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|