|
GetKeyState() is what I use, and I have had no problems with it. Just make sure you check only the low-order bit.
BOOL bCapsOn = GetKeyState(VK_CAPITAL) & 0x01;
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
can you explain this low order bit and high order bit stuff to me?
when i use this, i just check if the return value is -32767, like i seen in a VB example of using GetAsyncKeyState
|
|
|
|
|
|
Hi there:
I am double buffering (CMemDC) a view in a multi-splitted window, and I am still seeing flickering in a control that is dynamically created (slider bar) in one of the double-buffered windows. When I create the control it is with the Create function and the parent CWnd is the view within the splitter.
Does anyone know what is needed to get rid of this flickering? Thanks
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
I think in your parent window you use the WS_CLIPCHILDREN | WS_CLIPSIBLINGS styles and your children should stop flickering.
I think anyways
HTH
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Hello,
I have an application that uses WTL classes,
I try to add buttons to CToolbarCtrl
CImageList images;
1.
images.Create(32, 32, ILS_ALPHA | LR_CREATEDIBSECTION, 0, 2)
2.
images.AddIcon(CIconHandle().LoadIcon(IDI_FILEMENU, 32, 32))
images.AddIcon(CIconHandle().LoadIcon(IDI_SETTINGSMENU, 32, 32))
3.
TBBUTTON(..)iBitmap = iIndex;
4.
ctrlToolbar.SetImageList(images)
... and buttons have black background (there where should be transparent), of course i could set bg color with
images.SetBkColor, but toolbar in XP might have gradient bg...
What i do wrong ?
How to add an icon, in order to paint it with transparency?
NodeX
|
|
|
|
|
I develop a program for handicapped people. (Sorry for my English, French)
I found to intercept all the messages of the mouse towards my program (with MOUSEHOOK in a Dll) but I still have a problem.
How to simulate that the left mouse button is down (remain inserted)
to help the people for move items or to select text etc...
Thank you for your assistance
Jm Berckmans (jeanmichel.berckmans@skynet.be)
|
|
|
|
|
A very good introduction to global hooks : http://www.flounder.com/hooks.htm[^]
Not having done what you want to do, this is just a guess. How about, when your user presses the left mouse button down, you set a flag in your dll, and while that flag is set you block all subsequent left mouse button messages until the user does whatever they have to to clear the flag. I believe you can block mouse messages by having your hook function return any positive value instead of returning the value returned by CallNextHookEx() .
Untested code, but this should give you an idea.
LRESULT CALLBACK MouseHookProc(int code, WPARAM wp, LPARAM lp)
{
LRESULT ret = CallNextHookEx(m_hMouseHook, code, wp, lp);
if (!m_bFlagSet && wp == WM_LBUTTONDOWN)
{
m_bFlagSet = true;
return ret;
}
if (m_bFlagSet && (wp == WM_LBUTTONDOWN || wp == WM_LBUTTONUP))
{
return 1;
}
return ret;
}
HTH
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
hai all
Is it possible to invoke an application ie already installed in another computer of a network using vc++.
Please help me
Thank you
|
|
|
|
|
Basically, yes, and no.
For example, if you had a computer on the network that has a program MyRunThis installed, and the folder in which the application is was shared, you could start the program by using ShellExec and a command string "\\computer_name\folder\MyRunThis.exe".
In order to run a program on a remote computer, it must be made available by some way. This means that if the target computer's application's folder is not shared or registered as a DCOM server, you cannot start it. This is a security issue, thus making it impossible to execute malicious code without a clear security vulnerability first available.
If the computer resides on a LAN, it shouldn't be a big problem for you to share the target folder, then use ShellExecute to start it. If you have access to the application's source code, register it to support Automation, and this will allow you to create an instance of the application by calling CoCreateInstance.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello!
I'm not very good at vc++.
Could anyone let me know that how can I call up the Windows print dialog in vc++ (non MFC) ?
And how can I print out a MS Word/Excel doc. using the information retrieved from this print dialog ?
Many thanks for answering my question ! =^^=
|
|
|
|
|
Try using the ShellExecute function, with the operation argument set to "print".
Software Zen: delete this;
|
|
|
|
|
Thanks a lot for your help ! =^^=
I have already solved the printing problem by using "ShellExecute" !
However, it doesn't open the "Print" dialogue. Instead, it just sends the file to the default printer.
Would you like to let me know that how can I launch the "Print" dialogue by using "ShellExecute" also ?
Thanks a lot for your help again !
Betty
|
|
|
|
|
1. You need to find out details of the PrintDlg, PrintDlgEx and PageSetupDlg common dialog box functions.
2. You can't directly. You could save your settings as the default printer and settings (not sure about that last bit, but SetPrinter and stuff should help), and then call Word/Excel with print as an option on the command line - but then you've got to wait and restore the original settings, or the user will be mightily PO-ed.
Also, you'd have a problem printing just some of the pages that way. It might be possible to do it specifically for Excel and Word by using automation, but that feels like a large sledgehammer.
Steve S
|
|
|
|
|
is it possible to allocate more than 400 mb of phisical memory when your ram is only 512mb. i have successfully allocate about 360mb nothing more than that. why is that?
If you re expert on this one,please explain to me.
Thanks,
Shin
|
|
|
|
|
Even though Windows OS is a multi-tasking environment, and on the later versions (2000, NT, XP), it is capable of using the 'Virtual Machine' technology, you cannot allocate all memory for your programs.
The problem here is that even on the VM mode - Where every process of your computer believes it has all the system resources available, and a background process of Windows is taking care of processor time/memory allocation/swapping - the forementioned background process and Windows base services reserve a section of memory for private use. For example, the swap file reserves a piece of cache memory for itself to ensure optimized performance. Similarly, other base services such as HAL layer, Win32 API and SVC host take a piece of the available memory.
Thus, the resulting free memory is available for program use. On a Windows XP system, you can see the available memory from the Task Manager. As an example, my system has 1 GB of RAM memory, from which 707 Mb is currently available. Thus, ~300 Mb is taken by currently running applications and the background services. Putting all other applications to rest I can free up to 830 Mb of memory.
However, the base question is why on Earth do you need 400 Mb of RAM ? If you have a data store of that size, it is suggested to move it into a file or a database. This allows much smoother performance. Eating up RAM memory will slow down the performance of your machine, thus it should be used sparingly. Needless to say what a memory leak would do in this situation..
So, to answer your question: if you want all the 512 Mb of memory for your program's use, you must give up on Windows and/or Linux and use a non-resource hungry OS, such as Symbian OS. However, this will effectively reduce your program's visual output as well.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
confused:I can customize the existing CFileDialog by deriving a subclass from it. But the controls that i can drop into the extended CFileDialog dialog template are limited to only basic windows controls like EditBox,Buttons etc. I also watched that most of these controls are implemented in cmnctl32.dll library.Any attempt to embed any ActiveX control in the template simply shows up nothing - no file dialog.
|
|
|
|
|
I want to put a CButton control within a CReBar control.
I used the CReBar::AddBar method, but the Button appears disabled.
Is there another way to make this work?
Thanks!
|
|
|
|
|
Have you added a handler for the button's click ?
In order for a toolbar's (which a ReBar control is) button to be available, you must have a valid message map entry that handles the click on that button. If this entry is not available, the button is automatically disabled.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks a lot. Now it works.
But I have another problem: I have two Bands on a CReBar control. How can I resize the two bands to make them both visible?
(Sorry formy English!!!).
|
|
|
|
|
Use GetRebarCtrl under CReBar to get the ReBar control. Then use CReBarCtrl::SetBandInfo to set the band properties. Familiarize yourself with REBARBANDINFO structure. It has a member called cx to set the band's width.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi all,
Is it possible to detect the insertion and removal of removable storage? I need to know so I can call up a photo management application when this is done.
Regards,
Mark
|
|
|
|
|
Yes it is possible.
See this[^] link on the MSDN Library. It directs you to the home page of 'Remote Storage Manager' service.
This service can be queried to send notifications on a device's state. If you cannot find useful information from that link, use the keyword 'BeginNtmsDeviceChangeDetection' as a search parameter. This is a function that is used to request a notification object.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
|
I am importing a tlb in MFC which accepts safearray as parameter.
I have to pass filenames in this parameter. can anyone pl tell how can i pass filenames by safearrays as i am novice in vc++
|
|
|
|