|
how to make lparam and wparam of a kewdown message so that i can put into postmessage with an hwnd of edit box in order to see a perticuler key pressed into an edit box?
r00d0034@yahoo.com
|
|
|
|
|
You've been asking this question for days. Have you written any code in that time ? What is not working ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
yes i have developed an applecation which can install any type of software with out any user interaction on the network i have used (vb.net,csharp,vc.net).
for that purpose i have recorded events and stroed it into a file and with the help of threading i have replay it. it work nicesly but only for mouse events it works.
but it dont work for keboard events.
i dont know why thats why i am asking this question again and again plz help me.
plzzzzzzzzz
r00d0034@yahoo.com
|
|
|
|
|
What I'm asking is if you've tried anything to make it work, and if so, what ? You see, the more info you provide, the easier it is to help you, and it gives the impression you're doing more than just asking over and over again.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
i am giving you some part of my code so that you could help.
plz see it.
if part works but else dont (which is my problem).
if(E_to_Match->message==WM_LBUTTONUP){
::SetCursorPos(fp.x,fp.y);
PostMessage(h,WM_LBUTTONDOWN,0,0);
PostMessage(h,WM_LBUTTONDOWN,0,0);
::Sleep(500);
PostMessage(h,E_to_Match->message,0,0);
}else
{
::Sleep(2000);
PostMessage(h,E_to_Match->message,(WPARAM)E_to_Match->wParam,(LPARAM)E_to_Match->lParam);
}
only else part dont work here.
Control tranfer here only when a keydown and keyup message appear
before that i store E_to_Match object and set its values
in a CALLBACK function
LRESULT CALLBACK JournalRecorderFunc(int nCode, WPARAM wParam, LPARAM lParam)
{
...
...
E_to_Match->Class_name=c_n;
E_to_Match->W_text=wn;
E_to_Match->wParam=(Int32)wParam;
E_to_Match->f_point_x=f_point.x;
E_to_Match->f_point_y=f_point.y;
E_to_Match->lParam=(Int32)lParam;
E_to_Match->C_pt_x=C_pt.x;
E_to_Match->C_pt_y=C_pt.y;
E_to_Match->w_Level=w_Level;
LPEVENTMSG lpEvent2=(LPEVENTMSG)lParam;
Current_event->message=lpEvent2->message;
....
....
}
plz reply whats the problem with else part?
what to do because in else part hwnd is correct but dont displa key that is pressed.
it perform both keydown and keyup messages.
when i placed following line of code it display 777 in edit box.
i dont know why.
PostMessage(h,E_to_Match->message,103,
(LPARAM)E_to_Match->lParam); i am waiting for ur reply
r00d0034@yahoo.com
|
|
|
|
|
Have you traced through the code and verified that exactly the same PostMessage is occuring in both instances, with all parameters the same values ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
yes i have checked that whan key board event have to execute only then else part executed hwnd is also correct
because when i put that line in else part it will dispaly 777 in edit box
PostMessage(hWnd,
lpEvent->message,103,lParam);
r00d0034@yahoo.com
|
|
|
|
|
I'm using Chris Maunder's excellent CSystemTray class and I'm having some odd behavior that has to do with icon size. I don't believe that this has anything to do with Chris' class, but I thought I'd throw that in. What I'm finding is that the tray icon that's being inserted is the icon for my application, but an interpolated version of the large icon, not the real 16 x 16 icon. I've messed with SetIcon(icon,TRUE/FALSE) before inserting the icon in the tray to no avail. What's the proper procedure for guaranteeing the proper icon displays.
Paul Oss
|
|
|
|
|
Have you tried explicitly loading the 16x16 version of your icon, then setting this into the tray class?
I have run into this problem before, when just dealing with the shell tray directly.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have not. I guess I'm ignorant as to how to do that. I know how to load the icon (as resource) and then set the 16 x 16 through the SetIcon(xxx,BOOL) api (but that's not working for me). How do I explicitly load the 16 x 16 icon?
Paul Oss
|
|
|
|
|
You need to use the ::LoadImage API function, and specify the size for the icon, 16 x 16. Also, for the tray with anything below Win2000 and win9x you can only use the VGA palette for systray icons.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Be sure you use LoadImage() to load a 16x16 icon. LoadIcon() only loads 32x32 (the AppWizard generated code does this, but it's buggy).
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
#include <hash_map>
#include <string>
void foo {
std::hash_map<std::string, int> queries;
queries.find(std::string()); }
produces
C:\...\xhash(38): error C2440: 'type cast' : cannot convert from 'const std::string' to 'size_t'
error. That looks like a bug to me, since that is a fine C++ code.
looking into xhash we see
size_t operator()(const _Kty& _Keyval) const
{ // hash _Keyval to size_t value
return ((size_t)_Keyval);
}
which is at least weird.
Any comments?
|
|
|
|
|
Hi all,
I have a set of EXEs and an ActiveX control (ATL DLL) that perform some processing when invoked (the EXEs are invoked as usual from the command line and the ActiveX is invoked through scripting on a web page). Neither of these have a UI.
I now need to show a simple dialog box (a few fields for the user to fill) under some conditions determined by code in the EXEs or ActiveX. I don't want to have to duplicate UI code, so the discussion I've been having with The Powers That Be are leading towards putting the dialog box and its associated code in a DLL and call it as needed from the EXEs and the ActiveX.
The EXEs were written with the raw Win32 API (no MFC, no library at all in fact, no message pump either as they don't have a UI), and the ActiveX uses ATL. Both would now need to call a single function exported from my new DLL to show a UI as needed.
What is the simplest way to accomplish this, considering these requirements:
a) My DLL must be as small as possible
b) Can't duplicate UI code, must produce a single DLL
c) Neither EXEs or ActiveX DLL are allowed to become dependent on MFC or any large UI library. In fact I'm not allowed to introduce any new dependencies at all apart from this new DLL itself.
Normally if I had to display a simple form with those restrictions I'd write a simple Win32 EXE, and stick with the raw Win32 API and write the UI code with nothing else. A dialog box and a message pump--simple enough.
Can I, however, have a DLL exporting one function which, when called, displays this dialog box...and can still be called both from the EXEs and the ATL-based ActiveX? This is where my knowledge on the internals of ATL is limited: will a Win32 message pump residing in my DLL cause any problem?
Actually, the more I think about it, the more I believe my question doesn't necessarily rely with ATL, but rather, can a raw Win32 API application and an ATL DLL both call a DLL that has a self-contained dialog box and its own message pump?
Argh, I don't don't even know if I'm making any sense anymore...
I hate this, this should be simple but it's just not the type of thing I'm used to writing...
|
|
|
|
|
You can call ::DialogBox inside of your DLL function that has been exported, and that is all that you would need. You could develop a more elaborate UI if you desired using the raw Win32 API, or even WTL, but I think that would be overkill in this case.
DialogBox creates a message pump on the stack for you (that is how it becomes a modal window), and when you close the dialog box the message pump goes away with the dialog box.
You may want to add in some sort of synchronization in your DLL to only allow one of these dialog boxes to appear at a time, but I guess that all depends on how you want your system to work.
Lastly, this does not depend on any frame work, so you will be in the clear.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
?!? Gee Paul, you're absolutely right.
I think I've been looking at this problem for a little too long in a single sitting... I've re-read the message I posted yesterday and it's not exactly the most, uh, let's say "coherent" message I've ever posted.
Thanks for the quick reply (and sending me off in the right direction). I sense a sudden surge of inspiration...
|
|
|
|
|
Daniel Desormeaux wrote:
What is the simplest way to accomplish this, considering these requirements:
a) My DLL must be as small as possible
Then you simply have no choice: You must create your dialog on-the-fly to no have a RESOURCE (.rsrc) section in the DLL. I have done this myself for a simple text-input dialog usable from anywhere (as .lib or in a DLL or...) without messing up with resource ID's and such. Perhaps something similar could be of use for you?
Can I, however, have a DLL exporting one function which, when called, displays this dialog box...and can still be called both from the EXEs and the ATL-based ActiveX?
Yes. To be 100% sure (well, assuming resources are available) that it always works you'd however need to do something like what I've outlined.
I hate this, this should be simple...
I agree. However, it is Micros~1 created code we are dealing with...
|
|
|
|
|
> create your dialog on-the-fly to no have a RESOURCE (.rsrc) section
Ok, overkill. I need it to be as small as possible, but not that small. I'm still allowed to compile an .RC file.
Using Paul's excellent post (and much more to-the-point than mine) as a starting point, I managed to put this together without duplicating code and without any separate DLL. I do have to include the .RC in the EXEs and ActiveX projects, but I'm happy with this solution.
|
|
|
|
|
Hi
I'm programming a tool that collects game server IPs and logs them into a file. The logging is fine, however there are a lot servers with the same IP, that's why I want servers already logged not to be logged into the file again.
What is the best approach? Should I use an array, a linked list or something else where I should store all IPs in form of a string? And how can I search for strings inside an array/linked list etc.? Furthermore the technique should be very fast.
/edit: I should mention that I can't use MFC, only plain Win32 API
If someone could give me a hint or a link I would be very grateful
regards
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Use an STL set - it doesn't allow duplicates, and has log(n) time for searching.
Dave
|
|
|
|
|
|
Thanks!
I will give it a try
modified 12-Sep-18 21:01pm.
|
|
|
|
|
My function looks like this:
void ReplaceString(char *szSourceString, const char *szToReplace, const char *szReplaceWith)
{
char *szReplacePos = strstr(szSourceString, szToReplace);
char *szFirstPart = new char[strlen(szSourceString)];
while (szReplacePos != NULL)
{
memset(szFirstPart, 0, strlen(szSourceString));
strncpy(szFirstPart, szSourceString, szReplacePos-szSourceString);
strcat(szFirstPart, szReplaceWith);
strcat(szFirstPart, &szReplacePos[strlen(szToReplace)]);
strcpy(szSourceString, szFirstPart);
szReplacePos = strstr(szSourceString, szToReplace);
}
delete[] szFirstPart;
}
The szFirstPart pointer never changes but i still get a user breakpoint message. I have't free'd it before in the while loop so i don't understand it, any ideas?
THanks
|
|
|
|
|
|
Anonymous wrote:
char *szFirstPart = new char[strlen(szSourceString)];
char *szFirstPart = new char[strlen(szSourceString)+1]; // + 1 for the EOL char
Then take that char into account everywhere, for instance :
memset(szFirstPart, 0, strlen(szSourceString));
becomes
memset(szFirstPart, 0, strlen(szSourceString)+1);
How low can you go ? (MS rant)
|
|
|
|
|