|
I just tried this in VS 2008 and it compiles without any problem. What version of visual studio you are using and what type of MFC application you are working with?
-Saurabh
|
|
|
|
|
i use vs 6.0
and what drives me crazy is that i have another application that works FINE
but when i created anew one with the same steps
it gave me 70 errors starting with:
error C2501: '_ConnectionPtr' : missing storage-class or type specifiers
what should i do ????
i traced the two applications line by line but nothing is different....
|
|
|
|
|
I can understand your frustration but I do believe that something has to be different. If everything is same in two projects then it is not possible for one project to work and other to fail. So I will recomment that you try comparing the differences between two projects using winmerge[^]. It can compare differences between two directories as well.
-Saurabh
|
|
|
|
|
I'm trying to use Detours Library to prevent a Termination of a specific process
through the Task Manager, so I hooked a DLL in the Task Manager.
The Hooking part is fine, but the checking of which process is been terminated
not working for me.
i dont know what is wrong with this code
the if statement always returning false...
by the way the detours part is working ok.
BOOL My_TerminateProcess(HANDLE hProcess, UINT uExitCode)
{
TCHAR szName[MAX_PATH];
if (GetModuleFileNameExA(hProcess, GetModuleHandle(NULL), szName, MAX_PATH) != 0)
{
std::string str1(szName,MAX_PATH);
std::string str2="notepad.exe";
std::string::size_type pos = 0;
pos = str1.find(str2);
if (pos>0 && pos < 70)
{
return false;
}
else
{
return Real_TerminateProcess(hProcess, uExitCode);
}
}
return false;
}
|
|
|
|
|
Check the error code by adding @err,hr in watch window. You'll get the reason - why that function call is failed.
BTW one more point,
darx wrote: TCHAR szName[MAX_PATH];
if (GetModuleFileNameExA(hProcess, GetModuleHandle(NULL), szName, MAX_PATH) != 0)
You've used szName as TCHAR and called the ansi version - GetModuleFileNameExA() . Just call GetModuleFileNameEx() . If you compile this in unicode, this will pop error. Just an observation.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Which if is failing GetModuleFileNameExA or the inner one. If outer one is failing then you can try GetProcessImageFileName. In you code why are you using GetModuleHandle(NULL), when used in this way it will return a handle to the file used to create the calling process (.exe file). I think you should just pass NULL in the module handle.
-Saurabh
|
|
|
|
|
I tried using "GetProcessImagefileName()"
but I get "Access denied" GetLastError()
I also tried to use "GetProcessId(hProcess);
and I got the same Error
so I figured that I have to "SetSecurityInfo" to the
process, but I'm not Exactly sure how to Do that.
so anybody would like to help with "SetSecurityInfo"
with an example
|
|
|
|
|
i want write
if(c='\"')
cout <<"gy";
but this point do'nt excuted('/"')
running stop
|
|
|
|
|
Use '\\' instead of '\' because \ is a newline constant.
-@SuDhIrKuMaR@-
|
|
|
|
|
sofia_111 wrote: if(c='\"')
That's an assignement, not a comparison. What you are doing there is storing the character '\' in c and then checking if c is different than 0 (which is always the case because it contains the character you just assigned). You have to use == for a comparison.
|
|
|
|
|
yse sure i do this == in (if stattment)
|
|
|
|
|
Just adding one more point. This error occurs often and the best practice to avoid is to follow the following defensive style,
if( variable == constant )
{
}
if( constant == variable )
{
}
For instance,
if( variable = 1)
{
}
if( 1 = variable )
{
}
At first its a bit irritation for our eyes, but still it can save a lot of time.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Most modern compilers will issue a diagnostic for the
if (variable = constant) case when set to the maximum warning level.
I find the if (constant = variable) style intensely irritating.
|
|
|
|
|
exact:
iam looking for chractrers between " " in specified string
for(int i=0;i<gg[0].length();i++)
if (gg[0][i]==' " ')
{
t=i+1;
while (gg[0][t]!=' " ')
{
do any thing......
t++;
}
}
i do like this ( ==' " ') and this (==' \" ')
but didn't excute
|
|
|
|
|
gg[0][i]==' " '
gg[0][i] is a character.
' " ' is three characters.
|
|
|
|
|
just for explain
in programing i do as '"'
|
|
|
|
|
If its still making problem, then try this.
const char DoubleQuotes = 34;
...
if (gg[0][i]== DoubleQuotes )
{
}
BTW, is unicode defined in your project?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
my friends :
the problem here '\"'
|
|
|
|
|
i need to do an operation twice,so i do a button click twice..but i get this error..in win core.cpp.what should be done???
ASSERT(pWnd->m_hWnd == NULL); // only do once
Raja
|
|
|
|
|
Please post the 'offending' code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Can you Post code written for OnButton Ckick.
-@SuDhIrKuMaR@-
|
|
|
|
|
Can you show your code and is this question depends to your previous question?
|
|
|
|
|
And me too - "Please show the code snippet of Button click handler"
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Mohanraj D wrote: ASSERT(pWnd->m_hWnd == NULL); // only do once
Posting some code will help, but anyway! Looks like you are recreating a window that has already been created. You need to call DestroyWindow before recreating a window.
An ASSERT is provided just to warn you about an invalid action.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
how to prevent multiple clicks over a button??i need the button click to be done only once and after the operations inside the button are complete i need to enable the button,what should be done??
Raja
|
|
|
|