|
Here is a dirty trick to do so:
class ClassProtected
{
private:
int m_One;
UINT m_Two;
int m_Three;
};
class ClassPublic
{
public:
int m_One;
UINT m_Two;
int m_Three;
};
ClassProtected test;<br />
ClassPublic* pTest = (ClassPublic*) &test;<br />
pTest->m_One = 1;<br />
pTest->m_Two = 2;<br />
pTest->m_Three = 3;
|
|
|
|
|
I think it's a better way.
|
|
|
|
|
Usually, you souldn't.
Anyway, you can modify a class private member variable inside a friend function (or friend operator , or a method of a friend class ).
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.
|
|
|
|
|
Hi all,
suppose i have two projects both the projects have their seperate dsw and dsp files now i want to merge both of these projects and to combine their dsw files and make them one and both exe's should be created in one common debug folder. Is this possible in already created two dsw projects and if not how to create a new project like this??
thanks in advance
|
|
|
|
|
In one of your workspace, you can add an existing project. I think this is the best way to do it. I cannot tell you exactly what you need to do (don't have VC6 installed) but try to go to the explorer view and right click on the workspace, you should be able to add an existing project.
Just start from one of the two workspace, and add the other project (dsp) to it. You then need to configure the project properties (of both projects) so that the output folder is the same for both of them.
|
|
|
|
|
Thank you you were correct my problem is solved. Can you please tell me anything about child and parent exe calling.
|
|
|
|
|
neha.agarwal27 wrote: Can you please tell me anything about child and parent exe calling.
Uuh ? What do you mean ?
|
|
|
|
|
??
Do you mean calling one exe in another exe??
|
|
|
|
|
ya i mean that only but my second exe will be compiled with my first exe only by saying this i mean my second exe will not be residing anywhere on my disk.
|
|
|
|
|
can anybody tell me how to capture the enter key event from the keyboard.
Thank in advance
|
|
|
|
|
See PreTranslateMessage also you can use of WM_KEYDOWN/UP.
|
|
|
|
|
See here[^].
Real men drive manual transmission
|
|
|
|
|
Use the WM_KEYDOWN / WM_KEYUP and compare the parameter/variable nChar (contains info about which one was pressed).
Then compare it with an if if you just want to check once, or a switch if you want to differenciate more cases. Some possibilities are: VK_HOME, VK_END, VK_UP, VK_DOWN, ..., VK_PRIOR, ..., VK_ESCAPE, VK_ENTER... and so on, the complete list is in your docu and in MSDN.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Of course if you have a control on the form then all focus send to that control.
|
|
|
|
|
i tried like this
if(::GetKeystate(VK_ENTER<0)
{
mESSAGE
}
ELSE
{
MESSAGE
}
it is showing that vk_enter is undeclared where as it was working properly with vk_control,vk_shift etc
|
|
|
|
|
sorry, but I don't know what is happening. I have checked the docu to know if I told you a bad name, but it is VK_ENTER. So... if not working with it... I can not tell you what is wrong with it.
BTW, should not be another ) in your code?
if(::GetKeystate(VK_ENTER)<0)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I am using following code to create the new process. Now I want to Close the process that I have created. I am using CloseHandle() to close the Process with process handle as argument. But its not working.
The following code Opens the MSPAINT success fully when I press the 'c' But it doesn't get closed when I press the 't'.
PROCESS_INFORMATION OpenProc( TCHAR *CmdLine)
{
TCHAR str[100] ={};
_tcscpy_s( str, 100, CmdLine );
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL ProcCreated;
ZeroMemory(&si,sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWMAXIMIZED;
ZeroMemory(&pi,sizeof(pi));
si.lpDesktop = NULL;
ProcCreated =CreateProcess( NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi );
return pi;
}
int _tmain(int argc, _TCHAR* argv[])
{
char ch;
PROCESS_INFORMATION pi;
DWORD dError;.
do
{
scanf("%c",&ch);
if(ch == 'c')
pi=OpenProc(L"MSPAINT");
if(ch == 't')
{
CloseHandle(pi.hProcess);
dError = GetLastError();
CloseHandle(pi.hThread);
dError = GetLastError();
}
} while(ch != 'E');
}
|
|
|
|
|
Why you dont use of TerminateProcess ?
|
|
|
|
|
I used the Code Like this to terminate the process.
The code works fine when the Created Process is in the same desktop. But It doesnn't success when the Process created is in another Desktop.It doesn't show any Error but it doesn't close the opened process.
GetExitCodeProcess(pi.hProcess,&dwExitCode);
TerminateProcess(pi.hProcess,dwExitCode);
|
|
|
|
|
Can you get handle to this window and then send WM_CLOSE to it?
|
|
|
|
|
MSDN clearly says that "Closing a thread handle does not terminate the associated thread"
- NS -
|
|
|
|
|
GauranG33 wrote: TCHAR str[100] ={};
...
DWORD dError;.
These two statements are in error. That has no bearing on your problem, however, but it does make it somewhat difficult to debug something with syntax errors.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Send the opened process a WM_CLOSE message. Just closing your handle to it does not close the process.
You've received some suggestions to use TerminateProcess - that is the last way you should try if you can't close a process nicely. Using TP can causes memory leaks and issues if the process is using any kind of inter-process communication. It is a function-of-last-resort.
Judy
|
|
|
|
|
Hi friends
I am really new with Visual C++. I am using MS Access for DB.
I am trying to take data from a table and pass it to my recordset rs.
I am trying to check if i have received any records for my statement.
my code is
rs is CRecordSet.
While(!rs.IsEof)
{}
Here even when my DB has returned no data it goes inside the While statement.
I believe this is the standard statement to check if you DB has returned zero rows or no data, or whatsoever.
But even when i get Data or i dont still it executes statements inside While.
Any help would be appreciated.
Thanks
Cheers
Menon
|
|
|
|
|
use this code ,
while(!recset.IsEOF()) // Do until EOF
{
}
|
|
|
|