|
This is a subtle problem with templates, there's an explanation ahy it happens in here[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Really helpfull.
Thanks a lot Sashoalm.
|
|
|
|
|
No problem
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I have an application created with VS2005, consisting of some com-components created with VS2005. But one of the components is created by another department, so this component is still created with VS6. To find an error i have to debug from my application (VS2005) into this semi-external component(VS6). I have the symbols (.pdb) and the source files for the component and i succeed in stepping into the code of the component. But i can't watch any symbol. Has the PDB-format changed between this studio versions, are there any tricks to do the thing ?
|
|
|
|
|
Hi,
I want to change radio button while my program is running.
It start with normal radio button, but a want to change it while running so the text would be on the left side and the button on the right.
(It would look like radio button with "Left Text = true" when u click the button properties.)
I tried
CButton* button = GetDlgItem(IDC_RADIO1)
button->SetButtonStyle(BS_LEFTTEXT)
button->SetButtonStyle(BS_AUTORADIOBUTTON | BS_LEFTTEXT)
and few more but i failed.
Any idea ?
|
|
|
|
|
That isnt a good idea because it confuses a lot of users. Better rethink the design.
(if you really want to confuse the user, use 2 Buttons with one invisible and change the visibility)
Greetings from Germany
|
|
|
|
|
ido000 wrote: Any idea ?
Yes,
HWND hWndRadio = ::GetDlgItem(this->m_hWnd, IDC_RADIO1);
LONG lStyle = GetWindowLong(hWndRadio, GWL_STYLE);
lStyle |= BS_LEFTTEXT;
SetWindowLong(hWndRadio, GWL_STYLE, lStyle);
::InvalidateRect(hWndRadio, NULL, TRUE);
::UpdateWindow(hWndRadio);
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
[My articles]
|
|
|
|
|
I want to use of your code freely?
|
|
|
|
|
char str[8];
cin >> str;
When run, if inputed string size more than eight byte, result run time error.
So, how to limit cin >> size or only get eight byte when inputed more than eight?
thanks!
|
|
|
|
|
allocate memory dynamically based on the size of the string
You can use a loop (upto 8) along with getch()/getchar() to get the user input
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
cin statement doesn't provide you with limited input support. since it wait for RETRUN/ENTER key for updating the input character in buffer supplied to it.!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
std::cin.get(str, sizeof(str), '\n');
or
std::cin >> std::setw(sizeof(str)) >>str;
|
|
|
|
|
hanlei0000000009 wrote: When run, if inputed string size more than eight byte, result run time error.
Were you expecting a different result? Why not use a string object instead?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi Experts,
How can I import .rtf or .doc file content into TextBox.
|
|
|
|
|
Could anybody give reply?
|
|
|
|
|
For import doc file use rich edit control instead of edit control.
|
|
|
|
|
If you were using a rich edit control instead, you could just stream the data in.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
How can i get the path of the file opened, if i know that window handle.Is there any API for this.
Thanks
|
|
|
|
|
revanth1985 wrote: if i know that window handle
you can't find the name of file if you have window/FILE handle.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
If you are asking how to get the filename of an executable by knowing a window handle then this is how you do it. This code will tell you the PID of the executable even if you pass a child handle such as a button handle.
#pragma comment(lib, "psapi")
DWORD dwPID = -1;
BOOL CALLBACK EnumChildWindowsProc(HWND hWnd, LPARAM lParam)
{
if(hWnd == (HWND)lParam)
{
GetWindowThreadProcessId(hWnd,&dwPID);
}
return TRUE;
}
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
if(hWnd == (HWND)lParam)
{
GetWindowThreadProcessId(hWnd,&dwPID);
}
else
{
EnumChildWindows(hWnd,EnumChildWindowsProc,lParam);
}
return TRUE;
}
BOOL FindWindowProcessModule(HWND Hwnd, TCHAR *szName,size_t iMaxLen)
{
EnumWindows(EnumWindowsProc,(LPARAM)Hwnd);
if(-1 != dwPID)
{
HMODULE hModule = NULL;
DWORD dwNeeded = NULL;
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,dwPID);
if (NULL != hProcess)
{
if(EnumProcessModules(hProcess,&hModule,sizeof(hModule),&dwNeeded))
{
GetModuleFileNameEx(hProcess,hModule,szName,iMaxLen);
}
else
{
GetProcessImageFileName(hProcess,szName,iMaxLen);
}
CloseHandle(hProcess);
}
}
return NULL != szName[0];
}
Here is how you would use it:
TCHAR szName[MAX_PATH] = {0};
HWND Hwnd = (HWND)::FindWindow(_T("SciCalc"),_T("Calculator"));
if(FindWindowProcessModule(Hwnd,szName,MAX_PATH))
{
MessageBox(szName);
}
else
{
MessageBox(_T("Calculator is not running."));
}
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
Thanks for your reply.I don't want the path of the executable file,i want the working station of that file(for ex: D:\Work\New Text Document.txt).
|
|
|
|
|
You want the name of the process which has the file opened?
|
|
|
|
|
What i want is if a file is opened from D:\work\New Text Document.txt ,i want to get the path as stated before not the process name notepad.exe or excel.exe or some thing.can you help me out in this.
|
|
|
|
|
You can use function _getcwd(char* buffer,int maxlen) which will give you current directory. I hope this is you are looking for.Following simple code shows you how to use it.
char* buff,buffer[255];
buff = _getcwd(NULL,0);
cout<<buff<<endl;
|
|
|
|
|
SRKSHOME wrote: You can use function _getcwd(char* buffer,int maxlen) which will give you current directory.
How does that even come close to being a helpful answer?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|