|
Hi,
I have a dialog will get input from a 2D barcode scanner,
about a couple hundred characters.
I already override the PreTranslateMessage but still
not sure what's best way to capture the scanner input
as stdin.
I think my problem is that I am not too familiar with
Windows messaging. So, When I got a lot messages
inside PreTranslateMessage, I don't know how to filter
out & convert the data I want.
Can someone give me some suggestions?
Thanks,
Kevin
|
|
|
|
|
I'm not sure what you're asking....Does the scanner input come in a keyboard messages?
Steve
|
|
|
|
|
kevincwong wrote: Capture all keyboard input inside a dialog
You can do this by overriding PreTranslateMessage
append this code inside your PreTranslateMessage handler.
if(pMsg->message == WM_KEYDOWN)
{
}</code>
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Rajesh,
Great! that's exactly what I want. I know I read it from somewhere
before but just can not remember how to do so.
btw, when I pressed a key (for example 'a', the pMsg->wParm is 65,
']' is 221), I think the pMsg->wParm is the scancode (not ASCII code).
Am I correct?
Thank for you help!!
Kevin
|
|
|
|
|
kevincwong wrote: btw, when I pressed a key (for example 'a', the pMsg->wParm is 65,
']' is 221), I think the pMsg->wParm is the scancode (not ASCII code).
No, in the cases of the normal non-special keys, the values will be the ASCII codes for the keyboard key pressed (not the actual character received). So when you press <A> on the keyboard, you get a value of 65 , which is the same as 'A' . This should be the code received regardless of things like SHIFT or CTRL key state.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi James,
That's what I guess with alphanumeric character, like 'A'.
But it does not explain ']' (pMsg->Param == 221).
The ASCII for for ']' is 93.
It looks like 221 - 128 = 93.
Do you know why?
Thanks,
Kevin
|
|
|
|
|
Hmmm! No idea. Maybe different local/keyboard settings than standard US-English?
Maybe using MapVirtualKeyEx(...) with a MapType of 2 would help here?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi Kevin,
When some key is pressed, the value that arrives at
pMsg->wParam will be equal to the Virtual Key code of that particular key. Please look up MSDN for more details about Virtual Key Codes. Say, for example, when the 'p' key is pressed, the value that arrives will be equal to
VK_P which is the virtual key code of that key. If you need to know upper/lowercase detail too, use the
GetKeyState() function to know if shift key is pressed or if CAPS LOCK is turned on.
Please let me know if this solved your problem.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
|
Use GetWindowLong/SetWindowLong to change the Dialog proc to ur own custome made window proc. U can handle messages of ur interest, let the rest will be handled by defaultwindowproc
|
|
|
|
|
Hi,
I have a strange problem about GetNamedSecurityInfo() API to retrieve DACL of a network share folder.
I created a net share for the same folder respectively with the Steps A and Steps B as below in Explorer. My OS is Win2K Pro.
I do not know the result difference between Steps A and Steps B! In fact, I think they just did the SAME thing:
share the folder and grant 'Full Control' to 'Everyone'.
But, the same API call gets DACL with NULL for the former while a correct value for the latter!!!
It's so strange!
Any helps? Thank you for your comments very much!
David
=============================================================================
Steps A:
Right click the folder,
Select 'Share',
Click 'Share this folder',
Click 'Apply' to close the properties window.
Steps B:
Right click the folder,
Select 'Share',
Click 'Share this folder',
Click 'Permission' button to open a new window,
For the default 'Everyone', click 'Full Control' TWICE,
Click 'Apply' to close the new window.
Click 'Apply' to close the properties window.
my code as below:
PSECURITY_DESCRIPTOR pSD;
PACL pDACL;
ULONG result = GetNamedSecurityInfo(pszShareFullName, SE_LMSHARE, DACL_SECURITY_INFORMATION, NULL,NULL, &pDACL, NULL, &pSD);
if( result == ERROR_SUCCESS )
{
ACL_SIZE_INFORMATION aclSize = {0};
if( pDACL != NULL )
{
// here
// why different result?
//
}
}
|
|
|
|
|
Could it be in the first case it gets default properties from its parent, but if you ask for them explicitly, then nothing is returned?
In the second case, you applied security against the object explicitly.
It would be curious to test the DCAL against a share one level higher (its parent)?
That is, create a share with the properties you want. Repeat your steps for a share embedded within the first share. Get the DACL for each, the parent and the child, and see what are your results.
|
|
|
|
|
hi All, How to restrict access to folder in
windows XP, only my application (developed in VB)
can read and write to folder, nobody can copy
from that folder, is it possible??
restricted folder got files need for my
application (.txt, .conf, .ddl and .ocx files)
Any suggestion to achieve the above will be
greatly appreciated
-bala-
|
|
|
|
|
I think Windows XP doesnt have this function. You can restrict access to folder if you run a special application, but in default, Windows XP cant help you. If you log on an admin account, you have all access, but if you log on an limited account, you will be limited (sure). So, you can install ur program with admin acc, and then run the program with limited acc. I think this's not what you want, but that is the only way (with my knowlegde). If you using Unix (or Linux), you can chmod 755 thefile (^_^), only root can copy it. Good luck.
|
|
|
|
|
Administrators (Administrator in Windows, root in *nix) always can gain access to all files.
It is, however, possible to "hide" files. That is, for example, what Sony did with their copy protection system. And it got them to court, because hiding a folder through tricks means that someone else can "adapt" to your folder and use it for dark purposes.
When you hide a folder (other than with File-Systems means of setting a "hide" attribute) you always will create a vulnerability.
If I was you, I would include an "important information" file in your folder and ask the user in the manual NOT to change, create or delete files in that folder.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
|
I try to use named pipes with problem. I test following code:
HANDLE hPipe;<br />
LPVOID lpvMessage;<br />
CHAR chBuf[512];<br />
BOOL fSuccess;<br />
DWORD cbRead, cbWritten, dwMode;<br />
LPTSTR lpszPipename = "\\\\.\\pipe\\mynamedpipe";<br />
<br />
while (1) <br />
{ <br />
hPipe = CreateFile( <br />
lpszPipename,
GENERIC_READ |
GENERIC_WRITE, <br />
0,
NULL,
OPEN_EXISTING,
0,
NULL);
<br />
<br />
if (hPipe != INVALID_HANDLE_VALUE) <br />
break; <br />
<br />
<br />
if (GetLastError() != ERROR_PIPE_BUSY) <br />
cout <<"Could not open pipe"; <br />
<br />
<br />
if (! WaitNamedPipe(lpszPipename, 20000) ) <br />
cout <<"Could not open pipe"; <br />
}<br />
And I only get “Could not open pipe” from both CreateFile and WaitNamedPipe.
The error I get from GetLastError() is 2, "The system cannot find the file specified."
I can give the pipe any name and I get the same error.
|
|
|
|
|
Since you try to open the existing pipe \\\\.\\pipe\\mynamedpipe, does it really exist?
Where do you create the pipe?
|
|
|
|
|
I have 2 applications App1 and App2 in the same folder. App1 is a dialog. OnButton1 of Dialog of App1 i want to start the App2 and OnButton2 of App1 i want to close App2.
Can someone pls suggest any functions for this.
-- modified at 4:32 Friday 13th January, 2006
|
|
|
|
|
Try the following.
Use CreateProcess to start App2 and save the process information struct to be able to close the handles in it when you close either application.
Post WM_QUIT to the main thread of App2 when you want it to close. The thread ID is provided in the process information struct.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Use FindWindow() and postmessage function to send message to other app
|
|
|
|
|
That's one more solution.
I would choose the one I suggested earlier since I can post a WM_QUIT message using ::PostThreadMessage and I already have the thread ID which was given me in the process information parameter calling ::CreateProcess.
I would have everything I need to ask the second process to shutdown nicely, wait for it to end by waiting on the process handle and, if the process failed to close nicely after a desired timeout, I could terminate it using ::TerminateProcess.
I consider FindWindow an unnecessary round-trip, but it should work in most cases provided that the window name is known.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Hello Everybody...
I had some confusion.
1.What are the basic diffence in building a program in Debug and Release in VC++ 6.0.
2.Is there any affect to the logic of the code in this two versions.
thanx in advance
birajendu
CyberG India
Delhi
India
|
|
|
|
|
|
the simpler you can do to see a difference is simply looking at the generated .exe files sizes.
in debug mode compilation, the file is more "heavy" because the compiler don't perform some optimizations, and the more important, it does insert some functions into the generated code to perform the debugging thing...
if you are able to use a breakpoint, a step by step debugging, etc, is thanks to these.
in release mode, the compiler tries to make the exe the more performant as possible... when you make a delivery version of a project, provide the release mode compiled version.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|