|
He needs to an if before using of it on the wm_size .
|
|
|
|
|
SnaKeBeD wrote: i created an application in Mfc Dialog and i want to increase the dialog size as per the screen size programatically so that the controls in the dialog does not change its positions.
SetWindowPos is another api, apart from MoveWindow as quoted by Mr. Hamid (nice one)
"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
|
|
|
|
|
My MFC program has many line of code that using relative path like
("./data/test.jpg")
I alway reset the current directory after using CFileDialog so that
the ralative path - code in my program alway work ,
by doing something like this.
<br />
char currentDir[MAX_PATH];<br />
GetCurrentDirectory(currentDir);<br />
---- browse for file ------<br />
SetCurrentDirectory(currentDir);<br />
I has recently intregrated WinHelp in my program.
The problem is when user using WinHelp print function and selected those virtual printer like (Microsoft document writer) and browse for save path ,
My application's
current directory also change and since WinHelp doesn't block my application
(It a modeless dialog or something) I cant use the reset current directory method above.
Since my time is very limit , The only solution I came up here is
-------1.save the current directory into some static variable immediately after launching program
-------2.before calling and file access function that may invole relative path,
call SetCurrentDirectory(); with the saved directory
Will this solution alway work ?
since converting any relative part to absolute part is not an option now (some data are store in database as relative path)
I have to apologize for my very poor english and thank for answer in advance.
Xanagan
|
|
|
|
|
To ensure that you are in your APP folder:
char FileName[MAX_PATH];
GetModuleFileName(NULL, FileName, MAX_PATH);
CString m_szPath = FileName;
m_szPath = m_szPath.Left(m_szPath.ReverseFind('\\'));
Afterwards you can this to open/create files in the folder or whatever you need.
m_szPath += "MyDll.dll";
HINSTANCE hInst = LoadLibrary (m_szPath);
or...
m_szPath += "AnyDataFile.ext";
CFile f (m_szPath, CFile::modeCreate | CFile::modeWrite);
And with this you don't have to worry about the CurrentDirectory modified by CFileDialog, actually I use both options, but for different things.
Hope it helps
EDIT: Ups, I missed your "since absolute path dont desired", your idea about saving the current directory in a variable and set it back after modifying will work perfectly. But watch out here you save it. You may overwrite it without pretending it.
-- modified at 3:11 Tuesday 6th November, 2007
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
|
|
|
|
|
This seem more safe than calling SetCurrentDirectory before every file operation.
but the amount of code I need to modified is too much (I have both those Hard-code and some that query relative path-string from file/database)
So I may have to go with my first solution
(calling SetCurrentDirectory(applicationPath) before any set of file operation / in the head of function where I am sure that the current directory will not change).
will my solution has any side effect in the long term ?
Thank for your answer
|
|
|
|
|
With this code you dont need to call it everywhere. You can call it just once in your OnInitialUpdate, OnInitDialog or wherever class/module you need it, save it in a member variable and just replace the old vars names with the new one.
I mean, with this code you can save the m_szAppPath and use it as basis for all the other places, m_szFileName = m_szAppPath + "WhateverYouWant.ext";
And you can make it automatically with search and replace. I have used it a lot in my project :P
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
|
|
|
|
|
Yes it will work. Just assign the directory to a global variable and use SetDirectory after lines that may change the current directory the application is pointing to.
|
|
|
|
|
|
Hello everyone,
I have two DLLs and two related import libraries, and currently I want to merge them into one DLL and on import libraries.
Are there any smarter ways to quick merge them? Any tools in Visual Studio 2005? I want to keep the exported function in both DLLs and import libraries.
thanks in advance,
George
|
|
|
|
|
George_George wrote: I have two DLLs and two related import libraries, and currently I want to merge them into one DLL and on import libraries.
If they are two Win32/MFC based dll, you just have to include all cpp and h file, where there defination and decalration of exported function into one new project, also check for there dependency!
AFAIK there is no such tool for merging dll (Might be someother person have experienced in it), you have to manually collect files into one project!
"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
|
|
|
|
|
Thanks ThatsAlok,
Seems that there is no time-saving tool and I have to do such things manually.
regards,
George
|
|
|
|
|
George_George wrote: Thanks ThatsAlok,
you are welcome!
"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
|
|
|
|
|
still waiting....
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
this guy is acting stupidly on many forums over the internet, and he thinks everyone can still be gentle with him...
the worst is that every answer he get, he rates it. it's partially a good thing, but as soon as he doesn't understand a reply (because of his lack of knowledge) or when he has something more to ask (even if the first question was fully answered), he gives a '3'...
that's perfectly stupid and will end in braking people to answer him, i think.
an look Mark, he's still very insistant on for the answers he's expecting of us, but he never answers the questions we could have asked him. idiot
|
|
|
|
|
He has bayme not activated the option "mail me when someone answer this thread" or he has had a smash in head that makes him to forget checking his own messages and the "search comments" is very difficult to use :P
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
|
|
|
|
|
no no, he's just a moron, nothing more.
i'm now certain of this, because he's still arguing with someone else on a further thread in the board, and he answers to the other guy, but not to me. F*cking a$$hole
|
|
|
|
|
How to align Menu Item in AspDotNet
|
|
|
|
|
gunaarun wrote: How to align Menu Item in AspDotNet
...by posting this question in the ASP.NET forum and then making use of any sensible answer that you may get.
Real men drive manual transmission
|
|
|
|
|
Wrong forum for this question.;)
|
|
|
|
|
|
Does this question relative to c++?
|
|
|
|
|
where to add library file in VS 2005 IDE.... Plz reply..
Thanx'n'Advance
|
|
|
|
|
Right Click on your project on the solution explorer and select property then onpen Linker node and select Input and at the right panel insert your libs at Additional Dependencies.
|
|
|
|
|