|
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.
|
|
|
|
|
I would phrase it as "Only if you know what you are doing and are very sure about it you can go ahead with it" Many applications do modify the system32 folder
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
it's not because many application do it means it's good to do it.
if they do, it's because they are coded by lazy programmers who don't know they can add their installation folder in the path.
Microsoft (in a "Windows Best Practices" book i forgot the name) deprecates to write in such directories like system/, system32/, windows/ and so on...
modified on Tuesday, July 1, 2008 8:46 AM
|
|
|
|
|
Double Thanks for the input
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Welcome
|
|
|
|
|
Having read the replies, and having been there, the following suggestion:-
The Current working directory is easily changed, be it inadvertedly or otherwise. For instance, browsing with CFileDialog may change it. This can give rise to peculiar situations: Now it works, Now it doesn't. My approach is to use GetModuleFileName(). This gives the fully qualified file path to the file that is executing. Strip this back to the Directory of the current exe, and you have a starting point.Work out from here where 'CharacterAnimation.exe'is stored, and adjust the path accordingly.
So, the relative location between your exe and your target must be fixed!
If that is not the case, you should alow the user to browse for the file.
It is also good practice to default to a browse box (e.g. CFileDialog) if things go wrong, and the file cannot be found where expected.
And, ofcourse you should use ShellExecute() in stead of system.
Hope this is helpfull
Bram van Kampen
|
|
|
|
|
Hi, i placed CDateTimeCtrl (ShortDate style) om my dialog, and when I'm calling 'DoModal()' app crashes. When I debug I find it crushes at:
BOOL CDateTimeCtrl::SetTime(_In_ const COleDateTime& timeNew)<br />
function, at line:
ASSERT(timeNew.GetStatus() != COleDateTime::invalid);
where timeNew.m_dt=0.0000..., and timeNew.m_status is invalid???
The more oddly is that I never call this function (SetTime) in my code, so it must be called internally?!
I'm using VC++ VS2008, on XP!
All I needed is a simple control from which users can pick date (do not need time)!
Thanks in advance!
modified on Tuesday, July 1, 2008 4:44 AM
|
|
|
|
|
Set a valid time to the control before calling DoModal().
An Assertion tells you that there is something REALLY bad .
Greetings from Germany
|
|
|
|
|
I remove control from my dialog and put simple place holder and created CDateTimeCtrl in InitDialog() member function, everything worked fine.
<br />
m_DateTime.Create(WS_CHILD|WS_VISIBLE|DTS_SHORTDATEFORMAT,rc,this,IDC_DATETIME);<br />
But how I can add member variable to my control (CString)?
Before I did it through Wizard!?
|
|
|
|
|
Solved, It just didn't work for some time for no reason, now it's OK!
|
|
|
|