|
Google is your friend. See for instance: "argc and argv"[^].
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
Hi,
Is it possible to bind the "this" pointer to make a callback into a non-static class member function (c++98, no boost).
I don't think the "this" pointer is passed directly as a parameter to the function?
typedef void (*CallBackType)(void);
...
obj->SetCallback(std::bind1st(&MyClass::CallBackFunc, this));
|
|
|
|
|
No, it is not possible (at least as far as I know). From bind1st at C++ Reference : Return function object with first parameter bound
This function constructs an unary function object from the binary function object op by binding its first parameter to the fixed value x.
A method taking one argument is not exactly a binary function.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
You could use bind1st if CallBackFunc took one parameter:
void CallBackFunc(int) { ... }
...
obj->SetCallback(std::bind1st(std::mem_fun(&MyClass::CallBackFunc), this));
Since it takes nothing, you may have to write your own function template that takes a callable and a pointer that returns a small function object that stores the callable and the pointer as members and invokes them with operator(): as always, by refusing to use boost you're forcing yourself to reimplement parts of it.
|
|
|
|
|
I need to capture Desktop and Filter with some active windows
Or
I need to capture only Desktop i.e Desktop Background and Icons if some other active windows are maximized.
Please help me to do this. In my project this is main concept. Thanks to spend your valuable times for this.
Thanks & Regards
Narmadha
|
|
|
|
|
narmadha_s wrote: I need to capture Desktop and Filter with some active windows You need to explain better what you mean by this. What exactly are you trying to capture, and what do you want to do with it?
|
|
|
|
|
I want to capture total desktop. In that i have to filter my application window only. i.e Have to capture entire desktop with some restrictions. This is for like call center application.
Without my application window, i have to capture entire desktop. But my application will be visible and active window on desktop. Please kindle help me... Thanks to spend your valuable time for this.....
Regards,
Narmadha
|
|
|
|
|
|
If you already know how to initiate a "print screen" command to capture windows, then you could precede that with something like the following to minimize all windows first:
CoInitialize(NULL);
IShellDispatch4 *pShellDisp = NULL;
HRESULT sc = CoCreateInstance(CLSID_Shell, NULL, CLSCTX_SERVER, IID_IDispatch, (LPVOID *) &pShellDisp);
sc = pShellDisp->ToggleDesktop();
sc = pShellDisp->ToggleDesktop();
pShellDisp->Release();
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Thank you for the reply...
But i have to capture without minimize the windows. Actually, My requirement is,
I have to capture Entire desktop without my application window. My application will be visible and active window on desktop. Please do you have any idea on this help me...
Regards,
Narmadha
|
|
|
|
|
narmadha_s wrote: I have to capture Entire desktop without my application window. So then minimize just your app and then capture the desktop.
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
First. Minimize All running apps. Run the code below.
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
keybd_event(VK_MENU, 0, 0, 0); keybd_event(VK_SNAPSHOT, 0, 0, 0);
keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
return 0;
}
|
|
|
|
|
How can I change LVS_ALIGNLEFT by LVS_ALIGNTOP (of an CListCtrl) at runtime ? The list has LVS_ICON style already ...
Thank you.
|
|
|
|
|
|
What you are looking for is the funtion CWnd::ModifyStyle.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
I tried both solutions:
ListView_SetExtendedListViewStyleEx(m_List.GetSafeHwnd(), LVS_ALIGNMASK, LVS_ALIGNLEFT);
and
m_List.ModifyStyle(LVS_ALIGNTOP, LVS_ALIGNLEFT);
none of them are working ... I am not figure out why ...
|
|
|
|
|
You need to use
DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
There are probably some MFC shortcuts to this.
|
|
|
|
|
"There are probably some MFC shortcuts to this"
Yes, there is ModifyStyle (ModifyStyleEx), but seems not working either ...
|
|
|
|
|
Flaviu2 wrote: but seems not working Maybe you are not doing it correctly.
|
|
|
|
|
Is working by
ModifyStyle(LVS_ALIGNMASK, LVS_ALIGNTOP);
|
|
|
|
|
I noticed something: in order to work correctly, before I change the aligment style, I have to setup scrollbars of list control to top/bottom ... orelse, the list looks uggly (all items are bad drawned) ... it is logical to happend that ?
I am thinking that if I setup vertical scrollbar on some position, if I change the aligment style to horizontal, it doesn't fit at he same horizontal position ...
|
|
|
|
|
|
Hi,
i cannot figure this out:
hpp:
namespace ContractStorage
{
std::string DoIt(ContractName c); }
cpp:
namespace ContractStorage
{
std::string DoIt(ContractName c)
{
printf("yes");
}
}
It says: multiple definition of `ContractStorage::DoIt(ContractStorage::ContractName)'
How can this be, i only have the decalaration in the hpp file?
I have a class declaration in the same file, it does not complain about that...
|
|
|
|
|
There must be something else that is causing this that is external to your header file. I just tried that and it compiled without error. Does the error message give you any line numbers?
|
|
|
|
|
I noticed that the issue only occurs when i use "_" as function name. When i set it to something else it will work.
My namespace was named the same as my class, is it possible that the compiler did not detect the ambiguity?
modified 30-Sep-14 4:06am.
|
|
|
|