|
|
1、keyboard event:
keybd_event(VK_CONTROL,0,0,0);
keybd_event(VK_MENU, 0, 0, 0);
keybd_event('S', 0, 0, 0);
keybd_event('S', 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
::PostMessage(hWnd,WM_KEYDOWN,VK_CONTROL,0);
::PostMessage(hWnd,WM_KEYDOWN,VK_MENU,0);
::PostMessage(hWnd,WM_KEYDOWN,'1',0);
::PostMessage(hWnd,WM_KEYUP,'1',0);
::PostMessage(hWnd,WM_KEYUP,VK_MENU,0);
::PostMessage(hWnd,WM_KEYUP,VK_CONTROL,0);
2、mouse event:
CString gameCaption="XXXXX";
HWND hWnd=::FindWindow(NULL,gameCaption);
DWORD dwPid;
RECT rect;
POINT ptOld;
::GetWindowThreadProcessId(hWnd,&dwPid);
::GetWindowRect(hWnd,&rect);
::GetCursorPos(&ptOld);
::SetCursorPos(80,150);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
SetCursorPos(rect.left +200,rect.top +150);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
CString gameCaption="XXXXX";
HWND hWnd=::FindWindow(NULL,gameCaption);
::PostMessage(hWnd,WM_MOUSEMOVE, MK_LBUTTON, MAKELONG(80,130));
::PostMessage(hWnd,WM_LBUTTONDOWN,MK_LBUTTON,MAKELPARAM(80,130));
::PostMessage(hWnd,WM_LBUTTONUP,MK_LBUTTON,MAKELPARAM(80,130));
Sleep(10);
more Information,please click here.
http://blog.csdn.net/wangningyu/archive/2009/12/13/4994295.aspx
|
|
|
|
|
Hello Sirs,
The input image file size ~= 300MB tif..then i compressed that image up to 50 MB TIF using JPEG Compression ..when I pan 50 MB compressed image is too slow compared with original image size. please tell me why its slow ?
Please replay me !! Failure is Success If we learn from it!!
|
|
|
|
|
How big is this immage? In pixels...Look at that and tell us if you can work out why it's slow.... Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Thanks for your replay Sir ..
Actually in big size image movement is good as well as compared to compressed ..... Failure is Success If we learn from it!!
|
|
|
|
|
Are you decompressing the image in memory and panning that, or not? Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
im not doing any decompressing the image ..just im using LZW and JPEG compression algorithm in image file ans then i saved into tif sir Failure is Success If we learn from it!!
|
|
|
|
|
Hello Experts,
Actually i have a dll and Lib file but i don't know what is the function name for doing regarding operation. so i want to get the list of functions which are provided in functions.
So please help me.
ThanksIf you can think then I Can.
|
|
|
|
|
|
|
Hi
I am a little confused about how DuplicateHandle works
I am assuming this Function can be used for Interprocess communication
if so in Which process does this run the process wanting to aquire the handle
or the process that created the handle
Whichever is the case one of the objects ( the storage area or pointer to the storage area)
either target or source must be passed/sent to the other process
invoking the Duplicate handle
thankx
|
|
|
|
|
It can run in either process, though from what I have read on the function if it is called in a process other than the one aquiring the handle, you will need to use interprocess communication to pass the value (not sure why, if you have a pointer to where to store the handle). For this reason, I would say that it is better to call it in the process recieving the handle.
Yes, you would need to pass the pointer to the process with the handle, or the value of the handle to the process to recieve the handle.
|
|
|
|
|
Hi guys,
Is it possible to export a structure from a dll without including the header file where the structure is define? For example:
extern "C" __declspec(dllexport) struct MyStruct
{
MyStruct()
{
a = 0;
b = 0;
}
int a;
int b;
}
Instead of including mydllheader.h I want to do the following:
extern "C" __declspec(dllimport) struct MyStruct
I would like to use myimportheader.h in my projects that use the dll that way I can hide my structure implementation from the user. Is that possible?
Thanks.
|
|
|
|
|
You could do it this way but what is the point? If you hide everything from the user then what purpose is served by the structure? A better solution is to create a class that has methods but hides all variables and implementation details. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Not if the user of your dll creates instances of MyStruct itself. It needs to be a complete type if the user of your DLL is to create instances of it.
If you delegate all creation/destruction of MyStruct instances to the dll, you can achieve something like this. I've seen this sort of thing done with void *'s for the interface. I don't know if you could do this with a pointer to an incomplete type. If not, you could get a sort of type safety by wrapping the void * in a struct of its own with the definition of that struct exposed to the consuming application.Please do not read this signature.
|
|
|
|
|
I have the following crash which the debugger points to:
_AFXWIN_INLINE int CComboBox::AddString(LPCTSTR lpszString)
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); }
here is sample code:
Class B: public CDialog
{
CComboBox Box;
Box.AddString("xyz"); //This crashes
}
Class A: public CFormView
{
B pDlg(NULL); //launches Dialog B
}
|
|
|
|
|
You cannot "update" a control in a dialog before it's created.
so, all initialization must be done atleast after the OnInitDialog is called, and even in the OnInitDialog after the call to the base class OnInitDialog.
anyway, your code looks weird; are you certain that even compiles ?Watched code never compiles.
|
|
|
|
|
That isn't the exact code, was trying to show the problem without lots of code. I did figure it out, I was initializing before "UpdateData(FALSE)" in the OnInitDialog() function.
Thanks
|
|
|
|
|
Software2007 wrote: I did figure it out, I was initializing before "UpdateData(FALSE)" in the OnInitDialog() function.
You're calling UpdateData() in OnInitDialog() ? "One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Software2007 wrote: CComboBox Box;
Box.AddString("xyz"); //This crashes
Here the Box object is not created or associated with a combobox. So, there no valid handle associated with the Box object.
|
|
|
|
|
An assertion is hardly the same as a crash. It's telling you the exact line and file that is problematic (hint: it's not in your call to AddString() )."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi, I am trying to pass Flashvars to send some parameters to a swf using Visual C++, I´ve tried using put_flashvars but it doesn´t work. I am using the videoPlayer.swf that is included in the Adobe Flash Development Server. Using HTML there´s no problem, but in C++ seems not to work.
m_FlashPlayer.put_FlashVars(L"&videoWidth=0&videoHeight=0&dsControl=manual&dsSen sitivity=100&DS_Status=true&streamType=vod&autoStart=true&serverURL=http:/vod/sa mple1.flv");
m_FlashPlayer.LoadMovie(0,L"D:\videoPlayer.swf");
m_FlashPlayer.Play();
I also tried to input the variables in the URL string.
m_FlashPlayer.LoadMovie(1,L"D:\videoPlayer.swf?&videoWidth=0&videoHeight=0&dsControl=manual&dsSensitivity=100&serverURL=rtmp%3A%2Fvod%2Fsample2&DS_Status=true&streamType=vod&autoStart=true");
I don´t know what else to do. I checked in the web but i couldn´t find anything similar. Please help...
|
|
|
|
|
I have a class derived from CListBox which is owner-drawn (I implement the DrawItem function). My problem is I use a white brush for the background, but when the list box is empty, its background is just gray. As soon as one item has been added, the background becomes white.
My drawing function is very simple:
void CNiceListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CString txt = (const TCHAR*)lpDrawItemStruct->itemData;
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
CRect r(lpDrawItemStruct->rcItem);
dc.SetBkMode(TRANSPARENT);
dc.SelectObject(m_font);
dc.FillRect(&r, (lpDrawItemStruct->itemState & ODS_SELECTED ) ? &m_selectedBrush : &m_listBoxBackBrush);
dc.DrawText(txt, txt.GetLength(), r, DT_VCENTER | DT_SINGLELINE | DT_LEFT);
dc.Detach();
}
Where's the problem?There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
When the list is empty, there should not be a call to a "drawitem" since there are no items.
The background of the list (empty or not if less items than the size of the list) might dependent of your current color theme (vista, vista aero, xp, ... )Watched code never compiles.
|
|
|
|
|
You could implement the reaction OnEraseBkgnd(CDC* pDC) for your nice box
to process pDC->FillSolidRect(cClienRectOfBox, 0xFFFFFFFF) inside,
as example Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|