|
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
|
|
|
|
|
Place the macro USES_CONVERSION at the beginning of your function. You then have access to all of the string conversion macros. You can convert between any of ACSII (A), OLE (OLE), WIDE (W)and TCHAR (T). To convert ASCII to TCHAR do the following.
LPSTR *lpSrc;
LPTSTR *lpDest = A2T(lpSrc);
Similarly T2A, A2W, W2A, A2OLE, etc can be used. You can also put a C after the 2 to get a const string returned.
The good thing about these macros is that if you build the application with _MBCS defined, TCHAR is the same as ASCII so the A2T macros becomes nothing. If you build with _UNICODE defined then it will allocate a buffer and covert to Unicode for you. The memory is allocated on the stack with _alloca, so you can't keep the converted string after the function returns without taking a proper copy of it first. Also don't use inside a loop because it could allocate a lot of memory if the loop iteration is large.
|
|
|
|
|
John Saunders wrote: Place the macro USES_CONVERSION at the beginning of your function
John Saunders wrote: Also don't use inside a loop because it could allocate a lot of memory if the loop iteration is large.
If you use the newer ATL7 conversion macros then you do not have to use USES_CONVERSION and you can safely use the conversion macros inside a loop.
http://msdn2.microsoft.com/en-us/library/87zae4a3.aspx[^]
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thanks, this works fine. But I am wondering how the macros work. I followed the code and see that it ultimately ends up at defs for MultiByteToWideChar and others. But of course the code is not shown. So I wonder if this is implemented as just a big lookup table or if there is some better way to approach this.
Obviously this question has become somewhat academic at this point. My initial problem is resolved. But I am just thinking about how I would have implemented this and I don't see a better way than using a big lookup. That seems too clumsy.
|
|
|
|
|
An alternative to using the ATL macros is to use the _bstr_t class. It has constructors that take both ASCII and WIDE character sets, and have overloaded operators for both char* and wchar_t* . It will end up calling the same functions in the end (the MultiByteToWide, etc.) but it easier to read and debug since it isn't a macro.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
Im writing a webserver which loads an exe file as cgi application. What im trying to do is not make the window popup each time someone visits the site.
I still need the process visible in taskmanager though...
Heres what im using at this point to load the cgi app and get the std out... which is what i need to do...
char psBuffer[1024];
FILE *pPipe;
send(AcceptSocket, header, strlen(header), 0);
pPipe = _popen("test.exe", "r");
//..other functions
_pclose( pPipe );
Any Help on this matter is appreciated.
|
|
|
|