|
class CLogView;
CLogView* mLogView;
i just want to declare an object of CLogView class and its scope should be global.
|
|
|
|
|
the declaration using the class (here, declaring your pointer to CLogView) must appear after the definition of the class, not just the declaration...
class CLogView;
CLogView* mLogView;
ps: avoid global variables !!!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi again
Last idea i have is to use namespace;
using namespace pViewLog;
??!?
|
|
|
|
|
karmendra_js wrote:
Where should i declare Globals and how to handle them?
I would first reevaluate if you really need a global variable. In all but rare cases, they are not needed.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
To answer your question, the problem you are probably running into is that you are declaring your global variable in an H file. Thus every CPP file that includes that include file gets another copy of the global variable.
Instead of saying "int MyGlobalVariable = 525;" in the H file, say "extern int MyGlobalVariable;" and in ONE CPP file declare the global varible "int MyGlobalVariant = 525;"
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
how to make msflexgrid can editable by user??
|
|
|
|
|
MSFlexGrid, by itself, does not support user editting.
You might want to try this[^] instead.
Software Zen: delete this;
|
|
|
|
|
Hi
I have to update an existing Software to make it mor comfortabel. By now i solved the problem starting the software by double Clicking the registrated filetype.
But how to manage to read and view the File?? All that happens is, that the software starts with the default settings!?!
And how to manage to start the software by dragging the reistrated file over the EXEcutable?? All my tries ends up in Debug errors - Access Violation 0x000005
Thanks
|
|
|
|
|
I have created user message as follows:
define a user message in stdafx.h
#define WM_MYMESSAGE (WM_USER+1)
now in message map on class X add following messagemap
ON_MESSAGE (WM_MYMESSAGE, MyMessageHandler)
MyMessageHandler function is defined in class X.
Now to post message use the following code in the function where you want to.
PostMessage(WM_MYMESSAGE, 0, 0);
Now MyMessageHandler function is executed.
but the problem here is MyMessageHandler function is executed only if message is posted from within the member function.
if i post it form some other class member function nothing happens.
Can anyone tell me How can i post message from outside the class X.
|
|
|
|
|
karmendra_js wrote:
Can anyone tell me How can i post message from outside the class X.
for example you want to post message from classY ,then add the message map
ON_MESSAGE (WM_MYMESSAGE, MyMessageHandler) , in this class also and make the MyMessageHandler a global function
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
... and don't forget to post the message to the destination queue...
If the instanstance of your class is, let's say, DDD, then you use
DDD.PostMessage()
SkyWalker
|
|
|
|
|
There is also
PostMessage(HWND_BROADCAST,WM_CONNECT_EVENT,0,0);
Which I use to post a message from a thread to the main frame
|
|
|
|
|
Hi all,
Can anybody kindly tell me how to get the system volume values using Mixer Apis.
|
|
|
|
|
DWORD vol;
waveOutGetVolume(0, &vol);
|
|
|
|
|
Hi,
I need to restrict some html files on my machine needs to be restricted before it open. So, I used Hook process and call Createprocess API, my application filter such html files and I put return TRUE. But it shows me error message as
---------------------------
C:\For Test Different Extensions\1.htm
---------------------------
Windows cannot find 'C:\For Test Different Extensions\1.htm'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.
---------------------------
OK
---------------------------
If I put return FALSE, it shows me error messages as,
---------------------------
F:\differ ext\1.htm
---------------------------
There is not enough free memory to run this program. Quit one or more programs, and then try again.
---------------------------
OK
---------------------------
Let me know your ideas to quit those error messages.
My code is
DWORD WINAPI myCreateProcessW(
LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
)
{
if (IsValidProcess == FALSE)
{
MessageBox (NULL,"ToughGuard Filter this Process","ToughGuard",MB_OK|MB_ICONINFORMATION|
MB_SETFOREGROUND|MB_TOPMOST);
return 0;
}
CreateProcessW( lpApplicationName, lpCommandLine,
lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags,
lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
}
Be simple and Be sample.
|
|
|
|
|
Hi,
I am guessing it is long file names... See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
|
|
|
|
|
I have a menu with several items, one of which is a submenu. Normally, I use Class Wizard and ON_UPDATE_COMMAND_UI to enable or disable menu items.
But I'm not able to use the same technique to gray a submenu name itself because it doesn't have a command ID associated with it. Is it possible to gray a submenu item using MFC?
Mallikarjun Avanna Lavate
Mallikarjun Avanna Lavate
-- modat 6:34 Thursday 29th September, 2005
|
|
|
|
|
Greetings, everyone.
I stuck with an error "C2064: term does not evaluate to a function taking 1 arguments" when I try to pass pointer to class method as an argument to some method in template. Let's say I have a template with public method 'UserFunction' and private recursive method 'UserFunctionRecursive'
template <class TxData>
class CxTemplate {
public:
...
template <typename TxFunction>
void UserFunction(TxFunction pFunction) {
UserFunctionRecursive<TxFunction>(xData, pFunction);
}
...
private:
template <typename TxFunction4Recursion>
void UserFunctionRecursive(TxData xData, TxFunction4Recursion pFunction) {
if(bla-bla)
UserFunctionRecursive<TxFunction4Recursion>(xData, pFunction);
else
!!!!=> pFunction(xData);
}
} and I have a class which has user function and object of that template class
class CxClass {
public:
...
void Foo(int i) { ... }
CxTemplate<int> m_xObject;
} When I try to call 'UserFunction' method and pass Foo as an argument, I get the C2064 error (on line marked with !!!!=> above)
CxClass obj;
obj.m_xObject.UserFunction(CxClass::Foo); // error
and it's quite clear why, there is no instance of that function. So we have to make it static and it'll work. But, static function has no access to non-static members, so I can't make it static.
Any ideas how to make it work?
|
|
|
|
|
va`Lery wrote:
UserFunctionRecursive<txfunction>(xData, pFunction);
you need to call it like
UserFunctionRecursive(xData, pFunction) not UserFunctionRecursive<TxFunction>(xData, pFunction)
va`Lery wrote:
if(bla-bla) UserFunctionRecursive<TxFunction4Recursion>(xData, pFunction); else!!!!=> pFunction(xData);
make change like above
-- modified at 6:12 Thursday 29th September, 2005
|
|
|
|
|
Thanks for the suggestion, but it changes nothing.
The problem is that I can pass as an argument only static method or global function, and it works with the template I have. But, I need to pass pointer to method of existing instance of a class. That's where I'm lost.
|
|
|
|
|
ya you are right, lets wait for some expert for some help
|
|
|
|
|
I'm in no way an expert on templates, but since nobody else have found a solution I'll give it a try.
I don't see any place where you tell the compiler what TxFunction is to be instantiated to. To be a pointer to a CxClass member taking an int parameter returning void it should be
<br />
void (CxClass::*)(int)<br />
so perhaps you should call UserFunction as
<br />
obj.m_xObject.UserFunction<void (CxClass::*)(int)>(CxClass::Foo)<br />
(i would make a typedef of the member function pointer type!)
I haven't tried it so I have no idea if it will work.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
How can i get a refrence to the only created object of class X derived from CFormView?
I want to use public members of class X outside the class (from another CView derived class).
Thanks a lot
|
|
|
|
|
CMainFrame * fram=(CMainFrame*)AfxGetMainWnd()
CMyDocument *doc=fram->GetActiveDocument();
POSITION pos = doc->GetFirstViewPosition();
while (pos != NULL)
{
CMyScrolView* pView = doc->GetNextView(pos);
}
|
|
|
|
|
nothing got in my head can u write some words.
My application is a single document the splitter pane.
|
|
|
|