|
Great minds think alike.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Visual C++ MVP
|
|
|
|
|
Of course.
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]
|
|
|
|
|
Why in hell's name are you using strcat ? This doesn't make any sense on so many levels. strcat is a low level function whereas std::string is a high level class that's intended to manage to low level details for you. Even is the code compiled, the intention is flawed anyway: you have no right to mess with a std::string 's buffer. That's the reason why the buffer returned from the std::string::c_str method is const . Use code like this:
std::string path = dtCore::GetDeltaRootPath();
path += "/CharacterAnimation.exe";
system(path.c_str());
Why's exeroot used for? I can't see it being used in your code. Also note that the buffer returned from std::string::c_str is not valid if you modify the string.
Steve
|
|
|
|
|
toxcct wrote: std::string s = "Hello World";
char* psz = s.c_str();
Should be:
std::string s = "Hello World";
const char* psz = s.c_str();
Steve
|
|
|
|
|
I have changed the dialog's background color using WM_ERASEBKGND.
But how to give the same color to the menu bar in the dilaog?
|
|
|
|
|
owner drwan menu. Use the search box.
Greetings from Germany
|
|
|
|
|
|
Hi all,
I just wanted to know can we increase the size of static text(label we are using in dialog box) at runtime.... like i put text in my static text at run time using SetDlgItemText(), but sometimes when text is big it is not displayed i.e text is displayed according to the size of static text control....so what i want is that my control size should increase or decrease according to the text given...
Thanks in advance...
|
|
|
|
|
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString str;
CRect rect;
GetDlgItem(IDC_STATIC1)->GetWindowText(str);
int iLen = str.GetLength();
int iWidth = 8*iLen;//assume 8 pixel per character
GetDlgItem(IDC_STATIC1)->GetWindowRect(rect);
rect.right = iWidth;
GetDlgItem(IDC_STATIC1)->MoveWindow(rect);
return TRUE;
}
Nigah M Manzoor
modified on Tuesday, July 1, 2008 7:58 AM
|
|
|
|
|
Hey thanks its increasing the size but one more problem is there, where ever i put label when i run my program its showing the text at upper left corner only.....
|
|
|
|
|
use
GetDlgItem(IDC_STATIC1)->GetWindowRect(rect);
ScreenToClient(&rect);
instead of
GetDlgItem(IDC_STATIC1)->GetClientRect(rect);
Nigah M Manzoor
|
|
|
|
|
hey thanks it worked correctly
|
|
|
|
|
i also used the same code to resize my static text control it is working fine but one problem the text box width is not exactly according to the text it is little bit large. i want do like autofit to content. any idea?
|
|
|
|
|
Use this method.
CClientDC dc( pWnd );
CFont * pOldFont = dc.SelectObject( pWnd->GetFont());
CSize txtSize = dc.GetTextExtent(m_szText);
dc.SelectObject( pOldFont);
|
|
|
|
|
Has anyone come across an API or piece of code that allows partitions to be created and be formatted as NTFS?
I want the code to run under WinXP.
|
|
|
|
|
Hi!
I've designed an application. In this application, if I click one button, an exe will be run. This works fine on my system. I've called the system command in the startHandler of the button. Here is the handler:
static bool startHandler(const CEGUI::EventArgs& e)
{
int result;
result = system("D:/Projectname/Release/CharacterAnimation.exe");
return true;
} I will give only the GUI exe and the exe that will be run on clicking the Start Button(CharacterAnimation.exe) to the user. It has to run the CharacterAnimation.exe on clicking the Start Button. It runs properly in my System(Development machine). At other systems, it shows the following error:
"Could not find the file";
What to do to run the exe on all systems?
|
|
|
|
|
Path "D:/Projectname/Release/" will be invalid on the other machine.
Try to change the hard coded path to current working directory.
Regards,
Sandip.
|
|
|
|
|
How do I change?
Is this correct?
system("../../../CharaterAnimation.exe");
|
|
|
|
|
all depends on the current directory...
I suggest you to get the running directory of your exe, and to place CharacterAnimation.exe in the same folder.
|
|
|
|
|
As toxcct said you can use ShellExecute(..)
and check http://msdn.microsoft.com/en-us/library/aa364934(VS.85).aspx[^]
Get the current working directory and append the your exe name with the path.
One more thing when you are working through code i mean through IDE your working directory will be directory of the .dsw/.sln i.e. workspace directory so either you change it from the settings or copy the exe in that path.
I hope it makes sense.
Regards,
Sandip.
|
|
|
|
|
first of all, don't use the system() function but use ShellExecute instead :
::ShellExecute(NULL, _T("open"), _T("D:/Projectname/Release/CharacterAnimation.exe"), NULL, NULL, SW_NORMAL);
also, for you problem, the thing is that you're calling a file which does not exist at the specified location. the CharacterAnimation.exe in the folder D:/Projectname/Release/ only exist on your computer. you'd have to copy it with your exe, and find it's new absolute path to call it...
one last point.
why are you getting the result of system() into a variable, and always return true ?
|
|
|
|
|
|
REPOST[^]
You asked this question a couple of days ago. I asked you to use ShellExecute. Did you try it out? You can also use CreateProcess as per Hamid's suggestion.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
BTW if you put your exe in <drive letter.>\windows\system32 folder and then you don't need to full path to execute your exe with system command
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: if you put your exe in <drive letter.="">\windows\system32 folder
that's an awful solution. system folder should never be altered by any application.
Being in the path should suffice BTW.
|
|
|
|