|
codeguru again ??!!
|
|
|
|
|
Hello Mr toxcct,
How are you?did you have a good weekends?
I can say only :
and i say again,
Viens,laissons l'Avenir;laissons nos chagrins fous.
Jouissons du present et si doux!(Khayyam)
|
|
|
|
|
I have an application that places a custom button on the window caption bar. However I am having a problem when running on Windows XP.
I am finding that simply handling the WM_NCPAINT message causes XP to render the caption bar with the old Windows 2000 style. If I comment out ON_WM_NCPAINT() in the message map the caption bar is then drawn with the current XP style, put it back and the Windows 2000 style is used.
To make matters worse GetSystemMetrics returns caption icon sizes that match the XP theme, even when it is rendering the Windows 2000 style. This means I have no way of calculating the icon size and position.
I feel like I am trapped, I can't have the XP style because handling WM_NCPAINT automatically disables it, and I can't have the Windows 2000 style because GetSystemMetrics won't tell me the correct sizes. How does Microsoft expect people to now put icons on the caption bar?
Has anybody put a custom icon on the caption bar of XP and retained the themed style, how did you do it?
P.S. Popup dialog windows are render with the XP style regardless of what I do with the main window.
|
|
|
|
|
'simply' handling WM_NCPAINT does not turn off visual styles as you claim. You are probably calling DrawFrameCtrl / some other API in your nc-paint handler - this is what is turning off the visual styles for the window. Replace all your drawing with a BitBlt and it'll work fine.
|
|
|
|
|
Yes you are right I have confirmed that it is the drawing part of OnNcPaint that is stopping the visual style. Since I do my drawing after the default window processing completes, Windows must work out that I will be calling DrawFrameControl in the future and then render using the old Windows 2000 style.
I think all I have to do now is replace DrawFrameControl with some theme based drawing when running on XP. I have just added to code to load the uxtheme.dll library and get pointers to theme functions I need to call. I think I just need to do the following with appropriate parameters to draw my icon...
if (uxthemeloaded)
{
pOpenThemeData(...);
pGetThemeBackgroundContentRect(...);
if (pIsThemeBackgroundPartiallyTransparent(...))
{
pDrawThemeParentBackground(...);
}
pDrawThemeBackground(...);
pCloseThemeData(...);
}
|
|
|
|
|
John Saunders wrote: This means I have no way of calculating the icon size and position.
U can get the title bar height by taking the difference in the top of the window rect and client rect( do forget to call the ClientToScreen of the client rect ).
nave
|
|
|
|
|
Few days back i posted here the same problem.I want to get some answers pls help me.
In the application one keyboard is made by using a dialog with bitmap.Then by pressing the keys in that keyboard the application will get data like numbers,alphabets,enter key...like that.This keyboard have all buttons like the system keyboard.
I have to enter values to dialog edit control through this keys.So i get sample coding..In that they coded in keyboard class like..PostMessage(WM_KEYDOWN,49,0);
and in the corresponding dialog class where the value should entered they coded as
void CFacePlate::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
case 49:
sSktNumValue += "1";
break;
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
So i debugged the program..When ever the Postmessage function in Keyboard class is executed then the contol is going to OnKeyDown function in Dialog class.How it si going there?
I dont know whats happening there.
I coded like this for my application..but the control is not going to OnkeyDown function..How can i make that?
Anu
|
|
|
|
|
Hi all
i have developed a windows service. rite now i have to manually setup
folders, copy the exe of service to it n then manually install and start the
service from command prompt. Now i want to automate all this process. I want
to make a setup(installer) for that purpose. So that i only need to give that
setup program to somebody n when somebody runs that...everything is
installed, copied on its own......Please suggest me how do i make the
installer code....(something like proffesional software setup
programes).......also in which language it wud be easy to do it........my
service is in C++
thanks
kunal s patel
|
|
|
|
|
|
Hi all
i have a client/server application(infact server is a service and client is
a MFC gui) now i have a situation where i need to transfer username and
password over the network to the server from the gui.........but sending it
in plain text is harmful....so my question is how do i start a secure
connection to the server n send the information to it n then close the secure
connection
thanks
kunal
|
|
|
|
|
void CWDlg::OnBConnect()
{
// TODO: Add your control notification handler code here
strcpy(sessionid ,m_aapi.Login("usid","pssword");
}
|
|
|
|
|
hi
can u elobarate on wat u r trying to say...i didnt get it.....wat is sessionid...a char array???
Also i know how to get username n password information...i want to know how to send it over the network in a secure way....copying to a array n sending it in plain text is harmful.....so please suggest me a way to send it over the network in secure way
thanks
kunal
|
|
|
|
|
|
I have a requirement to find that which bluetooth stack is present(currently active) on the system? can anyone help me??
|
|
|
|
|
hello guys,
1) I have to take data from server and store in my msaccess database and also display the current changes in a text file I am working with dialog based application.And one more thing
If there is any good link pls provide me.
For this function i have create a button and I want by clicking that button the data from server will b display in a text file is that possible.
Any small hint will help to proceed further.
Thanks
-- modified at 1:04 Monday 31st July, 2006
|
|
|
|
|
|
1.One socket with 2 threads do read/write,is that ok?
2.One socket with 2 threads write to that socket with no lock,could the OS provide the receiver's pack oreded,that is,if thread A and thread B send message to the same socket with no sync protected,for exp A send "AAAA",B send "BBBB",is is possible for the receiver socket recive AAAABBBB(ordered) or ABAABAB(disorederd).
3.If using WSASend api to send a buf to several sockets,can we simply use a loop to send like following examples
WSABUF buf;
buf.buf = "test";
buf.len = 4;
Socket list[someNum];
for(i = 0;i++;i< someNum)
{
WSASend(list[0],&buf,1,...);//here we keeping use the same buf!!
}
if its not so correct,is there any good solutions?
Best regards!
|
|
|
|
|
Hello everyone!
I still don't quite get how C works... I always get weird, and I mean weird errors, like this one:
I have a char* string. It's a filename. If I printf() it, it gives me "x5" or other characters that don't have anything to do with it. But if I open the file, it opens correctly, and I can even display a string on the file...
Why is this? Is there a tutorial or something that explains this kind of stuff? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Kixdemp wrote: If I printf()
can you show us your printf() call ?
and, does that char* point to ?
Why donchoo take a peekchur mayn?
OK, cleeeeek
|
|
|
|
|
Interesting - you're learning C ? Do you do embedded work ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
|
I need some help converting between TCHAR strings and ASCII strings. (I understand that the actual type for TCHAR is decided by the compiler switches.) In this case, TCHAR is UNICODE. But I have a char* string passed into my function that I need to deal with. My questions:
What's the best way to convert the char* string (array) to TCHAR? I'm doing it one char at a time in a loop, but I am hoping for something more elegant.
How do I handle the ASCII end of string in TCHAR? For example, in one section I need to loop through the characters in the TCHAR string. I want to stop if I hit a new line from the char* string. That's easy in an ASCII string, but in UNICODE... well it's probably just as easy if you know what to look for! Should I be looking for TWO TCHAR characters (0xA and 0x0)? or something else?
Thank you!
|
|
|
|
|
there is an api for the same
MultiByteToWideChar()....
nave
|
|
|
|
|
Not Knuth wrote: How do I handle the ASCII end of string in TCHAR? For example, in one section I need to loop through the characters in the TCHAR string. I want to stop if I hit a new line from the char* string. That's easy in an ASCII string, but in UNICODE... well it's probably just as easy if you know what to look for! Should I be looking for TWO TCHAR characters (0xA and 0x0)? or something else?
wcstombs
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|