|
I have Windows 7 x64 in Spanish and the line:
HWND lHwnd = FindWindow("Shell_TrayWnd",NULL);
In my computer returns:
lHwnd=0x0002008c {unused=0 }
Hope it helps.
|
|
|
|
|
i read the thread for using getsockno
culd u ket me knw how t o get the port no i ma using c#
|
|
|
|
|
We could if you learn how to use English, not sms-speak. (cud, u, knw, ma).
If you don't want to show respect here, why should we help you?
|
|
|
|
|
Hi all,
please help me to resolve this error.
Error:: sprintf' : cannot convert parameter 1 from 'TCHAR [128]' to 'char *' in Unicode Build
i m build my project as unicode.
thanks in advance.
|
|
|
|
|
For UNICODE you should use: swprintf[^]
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
use _stprintf( it has to work for both UNICODE and MBCS code)
|
|
|
|
|
|
Hello everybody,
I'm creating an application for a barcodescanner-device.
In the main-thread, a
gets(buffer); waites for user key-input.
In a separated thread I poll on the barcode-scanner.
If the user scans a barcode, I extract the barcode and want to place it into the stdin-buffer.
Then, the gets()-Function should see the (new) data into the stdin and returns like a real key-input.
I tried it already this way :
fscanf(stdin,"%s",barcode);
fflush(stdin);
but the gets(buffer); still waites for user input.
Is it possible to manipulate the imput buffer in this way?
Big thanks for any help
|
|
|
|
|
I guess u can not write in input stream and you can not read from output stream.
However it looks like you have two threads one is reading Barcode from device and you want to pass it into another thread.
Why you are using gets for that? You have two ways.
1. Start second thread after reading the Barcode. Pass barcode as an argument of thread
or
2. If you can not pass then you can use global variable.
|
|
|
|
|
Big thanks for your answer.
I did it in the same way.
The Main-Thread and 2 threads for the input (one for keyboard and a second one for the barcode-scanner)
Greetings
|
|
|
|
|
As already stated, you cannot write to the read-only stdin stream. (Check the return code of fscanf.) You could try the following:
std::stringbuf buffer;
std::iostream stream(&buffer);
You can both read and write to that stream. You can have one thread collecting data from stdin, and one thread to collect data from elsewhere.
This stream will not be threadsafe however, so you have to add locks to read and write access. I suppose you can do something similar in C if C++ is not your choice.
|
|
|
|
|
Thanks for your answer
I resolve it with multiple threads, like your idea
Greetings
|
|
|
|
|
When should I use (*objectName).memberNameOrFunction and when to use objectName->memberNameOrFunction
I can access the member variables and functions by both the ways. So I am just curious when should I use which one.
|
|
|
|
|
For built in pointer types, there is no difference. I'd say using -> will make you code look more like users are used to, so I would recommend that. Your compiler would also not make any difference. Dereference and pointer operators can however be overloaded, but only someone insane would make an implementation that broke the intuitive functionality.
|
|
|
|
|
Thanks Niklas I will use ->
What do u mean by built-in pointers? what are others?
|
|
|
|
|
I was talking about pointer types.
You can mimic pointer behavior by overloading the pointer operator:
class A
{
public:
int intValue;
};
class B
{
A myA;
public:
A* operator->() { return &myA; }
};
B b;
cout << b->intValue << endl;
Here, b is not a pointer, but can be used as such.
But of course, then all bets are off since it will yield a function call, which may contain whatever.
|
|
|
|
|
|
Since objectName is a pointer, you must use -> .
There is no advantage in first dereferencing it with * and then using the . operator.
|
|
|
|
|
|
HI Guys,
I am using visual studio 2010 and I need to change the Mainframe icon at runtime based on my requirement so I have defined a macro _CHANGEICO. If this macro is defined I need to use some different icon and so I modified the .rc file accordingly and saved. Now If add any string or any new item to the resource all my macro declaration is deleted from the .rc file.
For example I have tried the following i.e. modified the resource file like this
#if defined(_CHANGEICO)
IDR_MAINFRAME ICON "res\\Orbit.ico"
#else
IDR_MAINFRAME ICON "res\\Sun.ico"
#endif
(OR)
#ifdef _CHANGEICO
IDR_MAINFRAME ICON "res\\Orbit.ico"
#else
IDR_MAINFRAME ICON "res\\Sun.ico"
#endif
After the above changes,I have added string to resource from visual studio, the .rc file is getting modified automatically like this
IDR_MAINFRAME ICON "res\\Sun.ico"
Can any one please help me in solving this issue, My changes should not be altered by the visual studio.
|
|
|
|
|
You should not modify the .rc file by hand, since it's content will be overwritten whenever you edit a resource in the resource editor. You should have a file named *.rc2 which the environment will not touch. Make your edits there. (I think this file is included as the last statement in your .rc file.)
Also, this will not change the icon at runtime, but at compile time.
|
|
|
|
|
|
I understood what you have said, I tried the same way the compiler is throwing errors like "res\IMAPP.rc2(75): fatal error RC1004: unexpected end of file found". Could you please give me a sample so that I can use it or instructions need to be followed for achieving this. Thanking u a lot...
|
|
|
|
|
#ifdef _CHANGEICO
IDR_MAINFRAME ICON "res\\Orbit.ico"
#else
IDR_MAINFRAME ICON "res\\Sun.ico"
#endif
works just fine here. Make sure your #ifdef is properly closed by an #endif, which is the only reason I can think of creating your problem.
|
|
|
|
|
Thanks a lot ..it is working perfectly fine now..
|
|
|
|