|
Man, you switched job?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
|
jeron1 wrote: See here[^].
Wow - thanks man!! Now I can finish my project and head off to laze in the sun instead of coming to work every day...
I'll send this to the rest of the team and we can deliver early!!
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Save a couple of beers for me! That site sure is a great time saver.
|
|
|
|
|
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]
|
|
|
|
|
I'm not exactly sure what its doing, but it seems to give me more pertinent answers than Wolfram Alpha, so I like it
|
|
|
|
|
|
hi
as we know, in a dialog box Tab and Shift+Tab change focus between ctrls, Tab to the next one and Shift+Tab to the previous one. when handling the keyboard event generated, we see that both generates the same event with the same wParam (0x09) and lParam (0x000d0001).
so how a dialog figures out which one is hit? apparently by using the function GetKeyState at the moment of handling the message. alright?
now, in a system with no tab key i want to use Up and Down keys in the place of them. at this moment the problem gets produced.
in the PreTranslateMessage of my application, i just change wParam from VK_DOWN into VK_TAB. the PreTranslateMessage of the base class (CWinApp) thinks Tab is hit instead of Down arrow. this is the behavior i intend and it's ok. but what can i do when the user hits Up arrow and expect the previous ctrl gets focused?
do i need to use SetKeyboardState and this is the only way to simulate hitting Shift key?
what can i do?
thx
|
|
|
|
|
Maybe this[^] article will help, with a couple of possible alternatives.
|
|
|
|
|
The other way to do it would be to replicate Windows tab-handling for VK_UP and VK_DOWN in the PreTranslateMessage method...
BOOL CtestmfcDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
if (pMsg->wParam == VK_UP)
{
CWnd* prev = GetFocus()->GetNextWindow(GW_HWNDPREV);
if (!prev) prev = GetFocus()->GetNextWindow(GW_HWNDLAST);
if (prev) prev->SetFocus();
return TRUE;
}
else if (pMsg->wParam == VK_DOWN)
{
CWnd* next = GetFocus()->GetNextWindow(GW_HWNDNEXT);
if (!next) next = GetFocus()->GetNextWindow(GW_HWNDFIRST);
if (next) next->SetFocus();
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
(tested with VS2010 Beta 1 - woo-hoo!)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
this is a good method. indeed doing what the dialog itself does in handling these keys again in our code for another keys. but when there're many dialogs in the program and i'm not going to derive them from a common base and put this code in its PreTranslateMessage method makes it a bit not a straightforward method. the code i've to write is what the others also r working on. all keyboard handlings must occur in the application's PreTranslateMessage. i know that it's not a logical limitation, but this is what i can do.
|
|
|
|
|
please notice the following code i put in the application's PreTranslateMessage:
...<br />
case VK_DOWN:<br />
pMsg->wParam=VK_TAB;<br />
BYTE byKeybState[256];<br />
GetKeyboardState(byKeybState); <br />
byKeybState[VK_SHIFT] = !(BOOL)GetKeyState(VK_SHIFT);
SetKeyboardState(byKeybState);<br />
break;<br />
...<br />
it must work. right?
but in CE it seems that GetKeyboardState and SetKeyboardState functions r not available. what can i do?
|
|
|
|
|
I'd use GetAsncKeyState[^] (which is in CE) and the SendInput technique documented in the other answer. The following pseudo-code shows the approach I'd use:
if (GetAsyncKeyState shows Shift is pressed)
{
use SendInput to send { Tab key press, Tab key release };
}
else
{
use SendInput to send { Shift key press, Tab key press, Tab key release, Shift key release };
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thank u
i think this is the solution i was looking for.
i'm going to implement it.
|
|
|
|
|
yeah, that's it!
thx
|
|
|
|
|
Hi all,
I am creating an application for windows Vista, XP and 2003Server. In my application I need to create and format partitions(Extended and primary both). I do not want to use DISKPART utility. Is there any other way to do this job like by using any win32API or any function provided by Microsoft in MSDN?
Please give me some suggestions.
Thanks
|
|
|
|
|
Ya ofCourse, you can use DeviceIoControl codes. for creating any partition (primary or logical) IOCTL_DISK_SET_DRIVE_LAYOUT can be used.
|
|
|
|
|
Thanks CMylife.
I am going to implement it now. I will consult you after trying it.
thanks
|
|
|
|
|
Its good that you are trying yourself. nothing you have to do. u first of all get the all partitions information by using IOCTL_DISK_GET_DRIVE_LAYOUT, then just edit the partition number, its offset, size and the last parameter , set that to true and finally run the IOCTL_DISK_SET_DRIVE_LAYOUT code from there itself. and then you are done with a new partition.
All the best.
|
|
|
|
|
Thanks CMyLife.
I am not sure that you will get my query today coz this thread is of one day old.
I have successfully created the partition using IOCTL_DISK_SET_DRIVE_LAYOUT. But now I am stuck in formatting this raw partition.
There is one function FormatEx() but it is only for Vista. Is there any other way to format partition without using DISKPART and SHFormatDrive like some ioctl code.
Thanks
|
|
|
|
|
Did you see FormatPartition and CreatePartition ?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
These look like they're for Windows CE.
Steve
|
|
|
|
|
google for FMIFS.h and FMIFS.dll to format any volume.
|
|
|
|
|
OH... Pardon me I have quoted you without reading this reply from ur side.
I am just checking for these FMIFS.h and FMIFS.dll
Thanks
|
|
|
|