|
You shouldn't use the returned pointer from gethostbyname() without checking it, it can be NULL. Here is an example source code[^].
Hope it helps.
/M
|
|
|
|
|
How to include the resource file in Static lib?
How to invoke the dialog which is created in above static lib from Application(exe)?
Regards
Mallikarjun
|
|
|
|
|
hi
can u create ur own file extension in vc++ so when u double clicked ur application icon ,it opens in ur application .
thank u
any attachments would be helpful
thanks again 
|
|
|
|
|
Assuming I understood your question correctly, yes.
Steve
|
|
|
|
|
thank u
do u have any idea how can i do this.
i mean create file extension for example ".clo"
again ...thank u
|
|
|
|
|
It seems it's no longer a yes or no question! The following .reg file will make CLO files open with Notepad.exe (it assumes Windows is installed to "C:\Windows"):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.clo]
@="clofile"
[HKEY_CLASSES_ROOT\clofile]
@="CLO file"
[HKEY_CLASSES_ROOT\clofile\DefaultIcon]
@="C:\\Windows\\system32\\shell32.dll,-152"
[HKEY_CLASSES_ROOT\clofile\shell]
[HKEY_CLASSES_ROOT\clofile\shell\open]
[HKEY_CLASSES_ROOT\clofile\shell\open\command]
@="C:\\Windows\\System32\\Notepad.exe"
To use this copy it into a text file, rename the extension to ".reg" and run it. This might get you started.
Steve
|
|
|
|
|
lahom wrote: do u have any idea how can i do this.
It was another yes/no question!
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
|
Hey guys ..
I have a situation where i need to simulate keyboard input in a (preferably) system friendly way.
I'm writing a user level driver for an usb device that has some keys mapped to some events the device generates. ie ( switch XX goes off , simulate a 'P' being pressed (something like that)) , device wise everything is working ok , i'm getting the info from the device , can write to it in bulk , and change settings on the fly through control ..
Now my problem.
I'm insinuating my keystrokes to the OS through the SendInput , and keyb_event api functions (tried both) .
But i'm runing a virtual KVM switch ( ive tried synergy and am now using multiplicity) which intercepts keyboard input , and sends it through the network to the other connected computers , when i'm working on those screens.. it handles normal keystrokes fine , but the keystrokes i send with the api functions just get ignored by both synergy and multiplicity.
So i was thinking .. do you guys know of a skeleton , or of someone that made minimal alterations to DDK's VHIDMINI driver ... so it behaves like a keyboard , and i can access it from user level and make it send keystrokes..The thing is , i want absolute compatibility on the lowest possible level.. and i'm sure i can't go wrong with a virtual HID there..
I'm sure more than one person has done this by now , and would like to know how they did it..
Or better still , are there more system functions to send keystrokes to the OS except SendInput and keyb_event that are transparent to applications.
Any reply is appreciated
Thank you in advance.
|
|
|
|
|
Its actually strange to me that SendInput() does not work. The only thing I can think of that will block SendInput is using DirectInput in exclusive mode.
This code will command the 8042 port at 60h to emit a keystroke. But only if you use something like PortTalk driver to give your application permission to do raw I/O.
http://www.beyondlogic.org/porttalk/porttalk.htm[^]
Here is the code I have used to emit keystrokes from the 8042 chip on the motherboard. You should know that not all 8042 chips will support this. It should be considered a hack.
VOID SendKey8042(int scancode)
{
_outp(0x64,0xd2);
_outp(0x60,scancode);
SleepWithEvents(33);
_outp(0x64,0xd2);
_outp(0x60,scancode | 0x80);
}
One more thing... the i8042 port only understands keyboard scan codes[^].
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you for this information , I'll have a close look at it and give it a go.
Regards.
|
|
|
|
|
I'm trying to share a C++ DLL between a C++ application and a C# application, but a DLL variable is being reset between invocations. Can anyone suggest what I may be doing wrong?
1. The C++ app calls a DLL function.
2. Then the C++ app starts a C# app (with a system () call) that sets a variable to a nonzero value in the same (?) DLL.
3. The C# app terminates.
4. Then the original C++ app looks at the DLL variable and finds it has been magically "reset" to its original zero value. (?!)
I'm assuming there's only ONE instance of the DLL, which is loaded into memory in Step 1. The DLL variable SHOULD BE nonzero in Step 4, but it's not. Any ideas what's going wrong? Thanks!
|
|
|
|
|
Alan Balkany wrote: I'm assuming there's only ONE instance of the DLL
That's wrong. Each process has a copy of the DLL in its own address space. If you need to share memory , then have a look at [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks Pallini! That's the information I needed!
|
|
|
|
|
Hi, all! How can I encrypt/decrypt some data with OpenSSL library and send/receive it using WSASend and WSARecv? I need it for FTPS...
|
|
|
|
|
Dr. Kelwin wrote: How can I encrypt/decrypt some data with OpenSSL library
Try this[^]
and then this[^]
should do it.
led mike
|
|
|
|
|
sorry, ask more precisely: how can i bind buffer, which i receive from WSARecv (this buffer send to my server from some ftps client), to BIO object?... for future decryption...
modified on Tuesday, April 15, 2008 7:28 PM
|
|
|
|
|
Actually 2 questions.
1. In CFileDialog, is the edit control ID 1148 or 1152 under Windows XP?
2. Is the ID still the same in Vista?
I'm trying to use SetControlText to set the file extension automatically when user selects the file type dropdown.
|
|
|
|
|
I don't know how to do this, but I bet you'll spend an awful lot of time hassling with this. Is there a reason you need to do this? Normally you would just wait till the user successfully closes the dialog and then get the extension and file name from the CFileDialog.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
A lot of applications have this behavior. For example, Adobe Photoshop, in the Save As dialog, if you choose a different file type, say JPG, it would automatically set your file name to be "mypicture.jpg". If you choose BMP, it would change it to "mypicture.bmp".
|
|
|
|
|
That's true Adobe does do that. But the thing is that you're having to work around or fight the system. In doing so you're causing a hassle for yourself and for the folks at Microsoft. Go read some of the articles at the "Old New Thing" - it's full of stuff like this. What if Microsoft changes the ID? Then your code is broken. Or they change to a different technique or control? All I'm saying is that, unless there's an easy way to do this, and I don't think there is (I could be wrong), that you're fighting something and spending your time on stuff that could likely be more profitably spent doing something else.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Create your own file dialog class derived from CFileDialog and override the virutal member OnTypeChange. That member is called when the selection in the type box is changed.
Judy
|
|
|
|
|
Jason Liu wrote: 1. In CFileDialog, is the edit control ID 1148 or 1152 under Windows XP?
Per Spy++, it is 0x480 , or edt1 from dlgs.h .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hey David,
Writing this from the MVP Summit, met Mark Salsbery, Joseph Newcomer, Nish, P J Naughter. Exciting for me!
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Nibu babu thomas wrote: Exciting for me!
Indeed.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|