|
IS there any solution to give color to TabControl buttons..........................?????
|
|
|
|
|
|
In a Dialog based MFC program, Can I use class CToolBar? or I just can use CToolBarCtrl?
And how to add two CTolBarCtrls in the dialog based program?
|
|
|
|
|
|
Thanks very much for your reply.
Yes, it will be very kind if you send me your sample. I'm fooled by it.
Send the sample to this email: albertkong1984@gmail.com
Thx.
|
|
|
|
|
The sample is already there in that link. Here is direct link[^]
|
|
|
|
|
Take a quick look at this link[^]">.
Regards,
Rane
modified on Thursday, September 4, 2008 11:59 PM
|
|
|
|
|
And how about adding two CToolBarCtrl in a dialog?
|
|
|
|
|
how can i give or set color of tabcontrol buttons (background color ) in visual c++ code.
|
|
|
|
|
|
hello all:
when i use NetWkstaUserGetInfo function
typedef struct _WKSTA_USER_INFO_1 {
LPWSTR wkui1_username;
LPWSTR wkui1_logon_domain;
LPWSTR wkui1_oth_domains;
LPWSTR wkui1_logon_server;
}WKSTA_USER_INFO_1, *PWKSTA_USER_INFO_1, *LPWKSTA_USER_INFO_1;
_WKSTA_USER_INFO_1 t;
char tm[100]={0};
NetWkstaUserGetInfo(NULL,1,(LPBYTE*)(&t));
strcpy(tm,(char*)t.wkui1_username);
"65168" is the t.wkui1_username value
why is not the current user name?
a beginner
|
|
|
|
|
alphaxz wrote: char tm[100]={0};
NetWkstaUserGetInfo(NULL,1,(LPBYTE*)(&t));
strcpy(tm,(char*)t.wkui1_username);
Since Unicode is defined, why not use:
TCHAR tm[100] = {0};
NetWkstaUserGetInfo(NULL, 1, (LPBYTE *) (&t));
_tcscpy_s(tm, _countof(tm), t->wkui1_username); alphaxz wrote: why is not the current user name?
Because t should be a pointer instead:
LPWKSTA_USER_INFO_1 t;
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I can't understand what do you mean?
a struct or a point to a struct ,any difference?
a beginner
|
|
|
|
|
Just take a look at the below piece of code and hope you will be clear..
DWORD dwLevel = 1; // Specifies the information level of the data
LPWKSTA_USER_INFO_1 pBuf = NULL;
NetWkstaUserGetInfo(NULL,
dwLevel,
(LPBYTE *)&pBuf);
The 3rd parameter is the pointer to the buffer that holds the data.
A point to note here is that this function will work only locally and will fail if you try to enumerate the list of remote users...
Regards,
Rane
|
|
|
|
|
thanks all
I've got the answer
the difference between ansi and unicode
a beginner
|
|
|
|
|
alphaxz wrote: I can't understand what do you mean?
I gave you the code. What's not to understand?
alphaxz wrote: a struct or a point to a struct ,any difference?
Yes, a big one. Notice the third argument to NetWkstaUserGetInfo() is supposed to be a BYTE** . The second pointer is there so that NetWkstaUserGetInfo() can allocate memory for the structure.
Don't forget to call NetApiBufferFree() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
thank u very much
i've got the answer under your instruction
a beginner
|
|
|
|
|
In the parent window, I use a child window to group controls, and want the parent window to handle their messages. In other words, let the child window only deal with position problems. Does Windows have any mechanism that supports this?
system
|
|
|
|
|
I am not sure, but in MFC there is a mechanisam for changing the owner using thr SetOwner() function. That is, the controls send the message to the owner windows. So try specifying the parent window as the owner of the controls.
Optionally you can trap all the messages of the child controls using the PreTranslateMessage() function.
|
|
|
|
|
Hi All,
I am working on Serial port function using NonOverlapped I/O(using VC6.0).
My Application to be communicated with a hardware device with 115200 baud rate.
Im able to receive the data correctly if I place a Sleep(1), in between two characters.
If I remove the Sleep, the data im received is correct for a single write and
Read. If it is continuous the data is corrupted.But If Sleep is there the response time of my application is very slow.
My Code is:
<pre>BOOL PortReadThread (COMMN_CTRL_CLASS *pCCommnCtrl)
{
while (TRUE)
{
// Wait for a character in input buffer
WaitCommEvent(pCCommnCtrl->hCommn, &wEvent, NULL); //from NULL
do
{
// Sleep(1);
wToRead = pCCommnCtrl->ReadPort(&cRcvdByte,1);
if(wToRead>0)
{
Count++;
pCCommnCtrl->CopyRx(cRcvdByte);//process rxbyte
}
}while(Count<1);
}
CloseHandle(pCCommnCtrl->hReadThread);
return TRUE;
}
}
DWORD CCommnCtrl::ReadPort(BYTE *pBuff, DWORD nToRead)
{
if(!(ReadFile(hCommn, pBuff, nToRead, &wsidytesRead, NULL)))
{
if(GetLastError() == ERROR_IO_PENDING)
{
AfxMessageBox("PENDING");
}
else
{
wsidytesRead = 0;
ClearCommError(hCommn, &wErrorFlags, &comstat);
}
}
return wsidytesRead;
}
Communication time outs:
timeout.ReadIntervalTimeout = 0xFFFFFFFF;
timeout.ReadTotalTimeoutMultiplier =0;
timeout.ReadTotalTimeoutConstant = 0;
timeout.WriteTotalTimeoutMultiplier = 0;
timeout.WriteTotalTimeoutConstant = 0;
</pre>
If I place a Sleep(1), in ReadThread then even for continuous read and write the data is correct.But If I remove sleep, the data I receive is very fast but corrupted.
Please clarify If I need to chnage my code.
Regards,
Sunil Kumar
|
|
|
|
|
1/ Something went wrong with your pre tags.
2/ Read Flounder's essay on serial programming - it will hopefully help you avoid a few pitfalls...
http://www.flounder.com/serial.htm[^]
Iain.
|
|
|
|
|
I found this code:
cin.ignore(numeric_limits<streamsize>::max(), '\n');</streamsize>
to clear the input buffer but sometimes when I use it there's nothing in the buffer which results in the program stops and does not continue until I press Enter.
How can I check if there's anything in the buffer before I try to clear to prevent the program from stopping?
|
|
|
|
|
Because cin.ignore(std::numeric_limits::max(),'\n'); means ignore input upto the next newline. If there is no newline pending then you are going to have to input another.
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Sunday8PM wrote: How can I check if there's anything in the buffer before I try to clear to prevent the program from stopping?
What about cin.clear() or cin.flush() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Those do not clear the input buffer. Maybe clear it is not the word, I want to use cin.ignore but inside an if case telling me if there's anything in the stream.
I just looked at cin.peek() but I'm not sure how to use it, if I understand correcty it shows the next character in the stream but what should I campare the character to?
|
|
|
|