|
You will get events every time a new mouse position is regsitered by your application then reads the mouse button states and can detect a click that way.
You could also use OnClick and follow the last position given by your OnMouseMove handler.
The tigress is here
|
|
|
|
|
At last i found a solution...
I just simulate a drag operation, to do that, when the user clicks my button i simulate that the user press the right button using
mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0, GetMessageExtraInfo());
Then when the cursor is outside my client area im still able to set the cursor shape.
Once the user clicks in the other window, i simulate that the user releases the right button using
mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0, GetMessageExtraInfo());
And after that, i simulate the click the user has just done
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0, GetMessageExtraInfo());
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0, GetMessageExtraInfo());
This work great for me, maybe if you have a Context menu, this isn't going to work, you could try using the middle button...
Ok, i wrotte this because i saw a lot of post similar to mine, and very few answers to this problem.
Thx to all for your suggestions
|
|
|
|
|
Hello,
i am developing inbound application using Tapi 2.0. now i want to
convert that application in Tapi 3.0. i don't know much about com.
any one know how to create inbound application using Tapi 3.0.
Any source code available. Plase send me source code for handling
incoming call.
please help me.
Best regards
Riya jain
dafdd
|
|
|
|
|
Hi Everyone,
I want to be able to read the Registry "ProxyEnable" located within HKEY_CURRENT_USER and located at the following path Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings. What I want to be able to do is tell whether "ProxyEnable" is on or off. Not quite sure how to do that particular piece though.
Thanks in advance,
Matt
|
|
|
|
|
|
The issue I seem to be having is that ProxyEnable is actually a Reg_DWORD key, so I don't think I'm reading it in correctly and I'm not sure how to verify that its actually an enabled key. Basically if I were to get a value back from doing a query on that key, what do I compare its value to?
|
|
|
|
|
Matthew Devine wrote:
Basically if I were to get a value back from doing a query on that key, what do I compare its value to?
As I understand it, 1 means enabled, 0 means disabled...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Yeah that's exactly right, that's what I'm seeing
HKEY hKeyRoot,hKeyNew;
LPCTSTR lpSubKey;
LPTSTR Value;
DWORD retcode;
DWORD Value_type;
DWORD Value_data;
DWORD Value_size;
hKeyRoot = HKEY_CURRENT_USER;
lpSubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
Value = "ProxyEnable";
retcode = RegOpenKeyEx
(
hKeyRoot,
lpSubKey,
0,
KEY_QUERY_VALUE,
&hKeyNew
);
if (retcode != ERROR_SUCCESS)
MessageBox("Error opening key",_T("NO"));
retcode = RegQueryValueEx
(
hKeyNew, // HKEY (hkey) handle of key to query
Value, // LPSTR (lpValueName) address of name of value to query
NULL, // LPDWORD (lpReserved) reserved
&Value_type, // LPDWORD (lpType) address of buffer for value type
(BYTE *) &Value_data,// LPBYTE (lpData) address of data buffer
&Value_size // LPDWORD (lpcbData) address of data buffer size
);
if (retcode != ERROR_SUCCESS)
MessageBox("Error reading key",_T("NO"));
else
fout<<"Registry Value - "<
|
|
|
|
|
Matthew Devine wrote:
This seems to have solved the problem that I was having
Good!
Matthew Devine wrote:
Thanks again Jose, you have been a big help.
You're welcome. Glad to be of help.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Matthew Devine wrote:
...the reason the compare wasn't working was simply because I only had 1 "="'s after for Value_data
All the more reason to put the constant on the left side of the operator!
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
I'm using Excel Automation (#import method) to write data to an Excel file from my MFC application. The data export is working fine, with one exception.
The document for my app contains an enhanced metafile (as an array of bytes and a handle). I'd like to place this image in the Excel workbook I'm creating.
Can anyone help?
Thanks,
Greg Wellman
|
|
|
|
|
I need to process an INI file from a block of memory rather than a file on disk (the file's been read in and sent wholesale over a network). Are there equivalents to GetPrivateProfileString and the like which don't take a filename as an argument, rather a block of memory to work with? Any other suggestions?
Thanks all!
|
|
|
|
|
isn't writing the block of memory to a temporary INI file an option?
(don't know of any functions that work directly on memory)
- Indivara
"...This city desert makes you feel so cold.
It's got so many people but it's got no soul..."
- Gerry Rafferty, Baker Street
|
|
|
|
|
Yeah that was my first thought and it's what I'll probably do now. I don't really like the idea as it feels a little unclean.
It surprises me that there aren't alternative INI file methods which work on memory blocks.
Cheers!
|
|
|
|
|
So if the INI information came from a file already, why not use the INI functions to read it rather than circumvent them?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The client sending the INI file data is dumb so I don't want it to interpret the INI file but send it over the network to the server which then interprets it.
Since I'm adding functionality and not writing a new system I wish to reuse the existing server's code which read INI files locally. E.g. there are functions in the server which exist:
ProcessINIFile(..., LPCSTR filename, ...)
And I want to extend these with:
ProcessINIFileFromMem(..., (void*)datablock, ...)
Having a set of INI file functions which worked on a block of memory (or even a CMemFile or similar) would make life much easier for me.
I agree that in any case it's not pretty but that's what you get when you're given a few tens of megs of a bunch of other people's code and asked to add bits to it in a hurry!
|
|
|
|
|
I haven't tried this, but perhaps you can create a CMemFile[^] (which is derived from CFile).
Next, use the CFile::SetFilePath[^] to give it a name (MSDN says it won't actually create a file, but it gives a path name).
Then you may be able to use that path name in your GetPrivateProfileString call.
CMemFile myfile (with appropriate parameters);<br />
myfile.SetFilePath("C:\\mydir\\myfile.ini");<br />
GetPrivateProfileString(........, myfile.GetFilePath);
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
It's worth a look although only for academic reasons since the hoops you need to jump through for this method are about the same as generating a safe temporary file, writing it out, feeding it back in and deleting it again. Guess the only advantage would be with this method, you can be sure the file will never actually be written out to disk whereas the second method the file might get flushed in its short existance.
|
|
|
|
|
krmed wrote:
Next, use the CFile::SetFilePath[^] to give it a name (MSDN says it won't actually create a file, but it gives a path name).
Then you may be able to use that path name in your GetPrivateProfileString call.
Hmm... no. That won't work. SetFilePath() will just store a path in the CFile object, so that later operations you call on it may use this value. But no one externally using this string as a path will be able to get to the CMemFile data.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I suggest writing it out as a temp file. When you create the file, use CreateFile and the option FILE_FLAG_DELETE_ON_CLOSE. As soon as the handle is closed (explicitly or the program crashing) the file will be deleted.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello, Im using the following line of code to draw a image in a window:
hSkinBmp=(HBITMAP)LoadImage(NULL, name, IMAGE_BITMAP, 0,0,LR_LOADFROMFILE);
HDC hdc = BeginPaint(hWnd6, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hSkinBmp);
GetObject(hSkinBmp, sizeof(bm), &bm);
BitBlt(hdc, 2, 30, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
ReleaseDC(hWnd6,hdc);
EndPaint(hWnd6, &ps);
UpdateWindow(hWnd6);
--
And it works, the image is being drawn on the window, but then when try to run this function again to load a different image in the same window (like a slideshow), the second image is not shown on the window (the old image stays), untill I minimize and maximize the window.
What could be the reason for that?
Thx in advance
|
|
|
|
|
grep2 wrote:
And it works, the image is being drawn on the window, but then when try to run this function again to load a different image in the same window (like a slideshow), the second image is not shown on the window (the old image stays), untill I minimize and maximize the window.
I'm not sure if that's the problem, but I'd try invalidating the window before drawing the second image.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thank you both for taking you time to answer my question, but infact the first answer solved my problem, invalidating the window area worked fine.
|
|
|
|
|
Is this by any chance in an OnDraw handler?
If so, then you should not have the UpdateWindow() at the end of the function.
If not, then the BeginPaint and EndPaint are not the proper mechanism for getting your DC, you should use GetDC and ReleaseDC instead.
BeginPaint and EndPaint are ONLY for use in the WM_PAINT or OnDraw handlers.
This is most certainly a fundamental part of your problem.
|
|
|
|