|
Hi everyone,
I am writing an application that can replace a keypress with another one, e.g. if I press the 'm' key on the keyboard, my application detects it and replaces it with 'x' for example.
This is achieved by setting a low level keyboard hook.
Up to now, the replacement map is hard-coded into the hook dll, but I want to configure it on the fly with a program in the TNA.
My question:
Is there a standard way of communication between my hook dll and the config program (i'm planning a callback function that is called everytime a key is pressed. it returns the replacement key) or do I have to think of my own with perhaps ReadProcessMemory, a MMF or something like that??
thx in advance,
Oliver
|
|
|
|
|
I am setting a socket option to use the KeepAlive feature...using setsocketopt(). If there is an error or break in the network connetion an error code is generated...but this can take minutes. I need an indication in seconds that there is a problem. Is there a way to do this??
Thanks,
Jerry
|
|
|
|
|
Last I checked the RFC (10 years ago) the timeout was 2 hours! If you need less you need to impliment that yourself. Basicly you need to ping the other end every second, and check for errors. However TCP does in order delivery, so if one packet is lost but the connection is otherwise good (this is a normal situation!) it can take more than one second for the retry.
You can get around this with UDP. In fact it might be better to use UDP for your keep alive because then you know which packets are lost, and when things are arriving out of order.
|
|
|
|
|
Hello, i am bunty, i needed some help, i want to learn more about c++ , i am currently studying it but i am failing to get it in my heads.I immediately need a program built in which:-
1)There will be a built in User Id and password for the startup of the program.It has to be password protected to ward off prying eyes.
2)it will have a treeControl on the leftside pane on clicking different sub-tree items on the left pane there will be a display window which will show different pre-built in written stuff which is un-editable.
I need it written in VC++.Please answer me through this column.Please help me someone.
|
|
|
|
|
|
Hello, i am bunty, i needed some help, i want to learn more about c++ , i am currently studying it but i am failing to get it in my heads.I immediately need a program built in which:-
1)There will be a built in User Id and password for the startup of the program.It has to be password protected to ward off prying eyes.
2)it will have a treeControl on the leftside pane on clicking different sub-tree items on the left pane there will be a display window which will show different pre-built in written stuff which is un-editable.
I need it written in VC++.Please answer me through this column.Please help me someone.
|
|
|
|
|
I am doing
char* junk;
stat = fread((void*)junk, sizeof(char),64880, inFile);
and it crashes. The file is much larger than 64880. What could I be doing wrong? Its binary data.
If I do:
stat = fread ((void *) &pingMarker, 1, sizeof (unsigned int), inFile);
it doesnt crash. I was just wanting to skip past a bunch of data and see what lies at the 64881th byte
thanks,
sb
|
|
|
|
|
ns wrote:
char* junk;
stat = fread((void*)junk, sizeof(char),64880, inFile);
junk is a pointer that has not been initialized (so it points to an invalid adress). When you call fread with this pointer, it will try to write something at this invalid adress and will crash.
Try this instead:
char* junk = new char[64881];<br />
stat = fread((void*)junk, sizeof(char),64880, inFile);<br />
delete[] junk;
or
char junk[64881];<br />
stat = fread((void*)junk, sizeof(char),64880, inFile);<br />
|
|
|
|
|
|
ns wrote:
I was just wanting to skip past a bunch of data and see what lies at the 64881th byte
Yes, a better solution is to use fseek. Take a look at the msdn for more info.
|
|
|
|
|
Hello,
I have already communicate with a lot of experts and read a lot about my
problem which is as follows: I want to develop a generic program for a
PocketPC, which logs the method-call and the time when any button or anything
else is executed, respectively a method is executed, in a file on the Pocket
PC. I need this for Usability studies. Every experts told me that i can reach
this only with embedded c++ or c code. I wrote my previous programs always with
c#.
So i want to ask in this forum if somebody can help me to solve my problem?
- this would be very important for me, because i need it for my diploma
(thesis).
thanks in advance.
Regards.
Patrick
|
|
|
|
|
In VS, there is a window that shows solutions, classes etc.
If in class view you can see all components of that class. If the class contains enums etc. you can see all of the components by name in their respective groups.
Say:
Enums<br />
----balahBlah<br />
------bl<br />
------bla<br />
------blah
(Dont mind the ----)
The elements of enums etc. are listed by name but in case of enums the named values are actualy type int.
Q: Is there a way to force VS to organize the elements by value?
(VS only organizes by name, access, and group!)
Eg. If say blah = 0; it should be first in the list and if bla = 2; it should be last.
Thanks in advance!
|
|
|
|
|
Sorry, I have not been able to find such!
If you really want the enum items in order you could write
enum { blah = 0 };
enum { bl = 1 };
enum { bla = 2 };
and they will appear in that order in the class view. Though this seems a bit overkill for me!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
How can I make a CString to a char?
I don't now how big the CString is so how can I do it?
Please help me.
|
|
|
|
|
CString YourString = "Blahblah";<br />
char* szString = new char[YourString.GetLength()+1];<br />
strcpy(szString,YourString.GetBuffer(YourString.GetLength()) );<br />
delete[] szString;
Hope this helps
|
|
|
|
|
Thanks that works fine,
You are a life saver..
|
|
|
|
|
Larsson wrote:
You are a life saver..
... Ok, if you say so
|
|
|
|
|
cedric moonen wrote:
strcpy(szString,YourString.GetBuffer(YourString.GetLength()) );
While this does work, it would be much simpler with just:
strcpy(szString, YourString);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Just to be complete:
I think
char* szString = new char[YourString.GetLength()+1];
doesn't need the +1; (a "\0" is already in the CString)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
It does need it, cos the GetLength return the length of the string without the terminating \0
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
hello,
I've some strange problems while debugging, I've one solution with 4 project,2 are exe files, the other 2 are dll.
My problem is I can't see the value of variables while debugging outside the main file.
for example
<br />
case WM_INITDIALOG:<br />
<br />
SetWindowPos(hWnd, NULL, wi.rcWindow.left, wi.rcWindow.bottom, 300, 250, NULL);<br />
ShowWindow(hWnd,SW_NORMAL);<br />
if(hParser == NULL)<br />
{<br />
MessageBox(hwndMain,"LoadLibrary failed on parser.dll", "Error", MB_ICONERROR|MB_OK);<br />
break;<br />
}<br />
if(!AnalizeMMC(hWnd,NULL))<br />
{<br />
MessageBox(hwndMain,"Unable to process multi-media content file", "Error", MB_ICONERROR|MB_OK);<br />
break;<br />
}<br />
when I step into AnalizeMMC, that's defined into another .cpp file
<br />
bool AnalizeMMC(HWND hWndMMC,tag *ind)<br />
{<br />
char temp[30]={0};<br />
WIN32_FIND_DATA *wfd = new WIN32_FIND_DATA();<br />
HANDLE hFirstFile=INVALID_HANDLE_VALUE;<br />
HWND hList=NULL;<br />
FILE *fd=NULL;<br />
char test[50]={0};<br />
hList=GetDlgItem(hWndMMC,IDC_LIST1);<br />
hFirstFile=FindFirstFile("*.mmc",wfd);<br />
if (hFirstFile == INVALID_HANDLE_VALUE) return false;<br />
.....<br />
I can't see the value of temp,wfd,hFirstFile and so on...
I receive
wfd CXX0017: Error: symbol "wfd" not found
.......why this happens???, how to fix it?????
the same happens if I refer to content of another project.
Thanks
Paolo
|
|
|
|
|
Have you tried just debugging the DLL in question?
That is set the DLL to active project / startup project then when prompted for the executable choise the appropriate executable that uses the DLL.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I want to post the number of recipes I have in a database but when i run the recipe count function i get giberish in the message box.
question: how can i post a interger in the message box?
info: MFC SDI with database support
int count=0;<br />
CString post="";<br />
<br />
m_pSet->MoveFirst();<br />
<br />
while(m_pSet->IsEOF == FALSE)<br />
{<br />
m_pSet->MoveNext();<br />
count++;<br />
}<br />
<br />
post=count;<br />
<br />
MessageBox(post);
thanks
|
|
|
|
|
CShoun wrote:
post=count;
MessageBox(post);
Change
post=count;
to
post.Format("%d", count);
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I have placed a webcontrol on CFormView in a SDI application.I have assigned it a member variable m_webbrowser.
Also i have got a dilogbox derived from Cdialog in my application.
I need to access this m_webbrowser from my dialogbox.
Please let me know how to do it
|
|
|
|