|
Giorgi Moniava wrote:
but sometimes i manage to do it sometimes not
I don't have the impression that it is only sometimes.
Don't try it, just do it!
|
|
|
|
|
i DO agree....
... and that's been few days like this !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
This usually happens because the linker will grab the icon with the lowest id in it for use with the exe. Open up resource.h and make sure the icon you want for the .exe has the lowest id.
|
|
|
|
|
Hello,
I have written a function
GetFilesInDirectory(CString szpath) , which gets names of all filles in given directory,for example
GetFilesInDirectory("c:\\Windows"), now the problem is that
different people with different versions of Windows , may have their windows directory named differently
(WIN,WIN2000,...) i want to know if i can pass my function such value that will give all files from Windows directory,regardless how the user has called it, for example in REGEDIT , %Windir% is a variable that refers to the Windows installation folder.
Regards,
m0n0
|
|
|
|
|
GetWindowsDirectory()
GetSystemDirectory()
suhredayan There is no spoon.
|
|
|
|
|
|
TCHAR szWin[MAX_PATH];
TCHAR szSys[MAX_PATH];
GetWindowsDirectory(szWin,MAX_PATH);
GetSystemDirectory(szSys,MAX_PATH);
suhredayan There is no spoon.
|
|
|
|
|
|
LPCSTR means :
LP for Long pointer ('cause pointers are 4-bytes long)
C for Constant
STR for String
so, if you like GetWindowwDirectory() to write into your variable, it musn't be constant....
understand ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
wow very nice explanation thank you
very helpful
|
|
|
|
|
Hi all,
I want to run a program like NetworkSetupWizard. It Takes 1 minute in my computer, 0.5 minute in my friend's and so on.
How can my app finds out when the work finishes?
Please help me,
Best Regards,
Thanks.
|
|
|
|
|
If your intention is to run a new process and get notification when it stops, here is a good article :Link[^]
suhredayan There is no spoon.
|
|
|
|
|
What is your problem?
Do you want to get the time that program takes until it exits or completes an operation?
Don't try it, just do it!
|
|
|
|
|
Yes,
Exactly,
Please tell me if you know,
Cheers,
Thanks.
|
|
|
|
|
below is my code the whole program is for prompting user to enter 10 nos. b/w 20 to 100 while is there to check wheter the user entr the corect number or not, it will also check that the entered number is unique and was not previously entered by the user. at end of program simply it will display the non dublicate nos. whole program is correct and output is also correct but this program is taking integers in place of dublicate numbers. suppose the user enter 50, 60, 70, 89, 56, 200, 47, 50, 56, 95 and 21 here 56 and 50 are dublicate values my program is taking 2 values in place of them. what should i do as i don't want any other value in place of dublicate values. i simply want to display values (from abve example) 50, 60, 70, 89, 56, 47, 95, 21.
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int nTmp,i,j;
bool bFlag=false;
int a[10];
cout<<"entr 10 numbers b/w 20 and 100"<<endl;
="" for(i="0;i<10;i++)" {="" while(!bflag)
="" cout<<"enter="" value"<<endl;
="" cin="">>nTmp;
////Here we check first Condition
// no between 20 and 100
while((nTmp<20)||(nTmp>100))
{
cout<<"enter no b/w 20 and 100"<<endl;
="" cin="">>nTmp;
}
for(j=0;j<i;j++)
="" {
="" for="" checking="" whether="" the="" value="" is="" dublicate="" or="" not="" if(a[j]="=nTmp)" break;
="" }
="" }="" if(j="=i)" {="" save="" variable="" a[i]="nTmp;" bflag="true;
" again="" make="" it="" false
="" display="" non="" numbers.
="" cout<<"="" nos="" are="" "<<endl;
="" for(j="0;j<10;j++)" cout<<a[j]<<endl;
="" getch();
}="" <="" b="">
Rose
|
|
|
|
|
That is exactly the kind of a question I dislike.
Didn't you post the same questions some days ago?
Don't try it, just do it!
|
|
|
|
|
This slight modification to your code will get you closer to your end result:
void main( void )
{
int i,
j,
nNumber,
a[10] = {0};
for (i = 0; i < 10; i++)
{
do
{
cout << "Enter a number between 20 and 100: ";
cin >> nNumber;
} while (nNumber < 20 || nNumber > 100);
for (j = 0; j < i; j++)
{
if (a[j] == nNumber || a[j] == 0)
break;
}
if (a[j] == 0)
a[j] = nNumber;
}
cout << "The non-duplicate numbers:" << endl;
for (j = 0; a[j] != 0; j++)
cout << a[j] << endl;
getch();
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have derived a class from CButton , named CMyButton , when i add function(for exmple)
void CMyButton::SetButtonText(CString text)
{
this->SetWindowText("");
}
//and then call
CMyButton b;
b.SetButtonText("test");
//it compiles succesfuly
but then i get debug assertion failed, and in debug i get "invalid window handle", i know the problem is in
this->SetWindowText("");
can anyone tell me what i have write instead of "this->",to avoid this problem??
Regards
m0n0
|
|
|
|
|
You never created the window for the button. See CButton::Create in the help.
John
|
|
|
|
|
Look John, it's my mistake i had to be more clear in my thread ,
i have alerady created a button using simple toolbox and added a variable to it , then in my ***Dlg.h file i have renamed it like this
//before
CButton b;
//after
CMyButton b;
so the button is already created, i have problem with
"this->" i think it is not correct the way i use it
Regards
m0n0
|
|
|
|
|
It is not the proper way to use it as I would never do that but there is nothing wrong with this-> asside from the fact that it is reduntant.
The proper way is to remove the this-> and just call the member function. But this is not your problem.
Again your problem is the button was never created. This is a windows thing and not c++. Every control must have a window created for the control itself and in most casess a window (or dialog box) created to place the control on.
John
|
|
|
|
|
You are being plagued by recursion (which you would have seen had you set a breakpoint on the this->SetWindowText("") statement). Change your code to:
void CMyButton::SetWindowText( CString strText )
{
CButton::SetWindowText("");
} and it'll work fine.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
His original code was:
void CMyButton::SetButtonText(CString text)
{
this->SetWindowText("");
}
I am not sure how this can recurse?
It was probably because he did not set it to a 'real' button window before trying to set the text.
One way to check:
void CMyButton::SetButtonText(CString text)
{
if( ::IsWindow(this->m_hWnd) ){
this->SetWindowText("");
} else {
// Gadzooks! No window is assigned yet! Set status to DefCon IV!
}
}
|
|
|
|
|
Blake Miller wrote:
I am not sure how this can recurse?
Did you not try it out? It can, and does, recurse. Why would it not? The call to this->SetWindowText("") matches the prototype of void CMyButton::SetButtonText(CString text) . This is all due to CString 's LPCSTR operator.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello David;
I just tried it out. No recursion occurred whatsoever.
SetButtonText does not get called by SetWindowText. The functions have similar signature, but different name. And that is why I originally did not beleive they would recurse, by inspection, but now I demonstrated to myself they do not recurse - by definitive testing.
I noticed that there was a runtime assertion on a window handle WinOcc.cpp - line 229 - ASSERT(::IsWindow(m_hWnd)); , but once I did SubclassDlgItem on an existing button control it works as expected. I maintain you can not SetWindowText on a CButton or CButton-derived class until the class has been assigned to an existing button window.
This is code path I observed:
CMyButton::SetButtonText -> CButton::SetWindowText -> ::SetWindowText
If you can get it to recurse, please explain exactly how.
|
|
|
|