|
I am using MFC and want to know the application folder (typically, but not necessarily "C:\Program Files\MyProgram") so I can read and save an initialization file for the program. A program that uses the main() function, arg[0] is usually the program's command line with subsequent arg[n] being the additional command line parameters. CWinApp does not appear to provide this information and I have looked through the help files and the CodeProject message board without success.
Any help would be greatly appreciated.
TIA
Ron
|
|
|
|
|
Well I dont use MFC I only know the API way so:
you can get it like this:
[code]
char path[_MAX_PATH];
GetModuleFileName(GetModuleHandle(NULL), path, _MAX_PATH );
[/code]
Path holds the full address of your exe like "C:\Program Files\Program\test.exe"
just delete text.exe from it and its done...
Well... I am a beginner ...
|
|
|
|
|
|
Check if this code is of any help :-
CString szCurrentDirectory;<br />
{<br />
CString csPath;<br />
<br />
<br />
::GetModuleFileName(NULL,csPath.GetBuffer(MAX_PATH),MAX_PATH);<br />
<br />
csPath.ReleaseBuffer();<br />
<br />
szCurrentDirectory=csPath.Left(csPath.ReverseFind('\\'));<br />
<br />
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks to all who responded. Problem solved!
Ron
|
|
|
|
|
:->
I need to Know how many number of disk devices and NIC cards are present in a system (through wmi classes).
how can i access this information.
Pradeep
|
|
|
|
|
Hi all
Will I am using GDI+ to manipulate images.
I am having this strange behaviour with Bitmap::Clone() function.
When I create a Clone from an Image object, and then try to LockBits for the cloned image, I get invalid pointer.
I did a workarround for this:
Bitmap* p_new_image = new Bitmap(p_src_image->GetWidth(),p_src_image->GetHeight(),p_src_image->GetPixlFormat());
Graphics* p_graphics = Graphics::FromImage(p_new_image);
p_graphics->DrawImage(p_src_image,0,0);
delete p_graphics;
will this code is working with LockBits very fine.
The documentation for the clone function is not clear, is this a bug in the Clone function, or I didnt understad the Clone function will?
Regards
Hesahm
Hesham
|
|
|
|
|
Hi guys,
i've implemented an manifest file to my app with following info:
---[cut here]---
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><br />
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><br />
<assemblyIdentity<br />
version="1.0.0.0"<br />
processorArchitecture="X86"<br />
name="SETUP.EXE"<br />
type="win32"<br />
/><br />
<description>APPLICATIONNAME</description><br />
<dependency><br />
<dependentAssembly><br />
<assemblyIdentity<br />
type="win32"<br />
name="Microsoft.Windows.Common-Controls"<br />
version="6.0.0.0"<br />
processorArchitecture="X86"<br />
publicKeyToken="6595b64144ccf1df"<br />
language="*"<br />
/><br />
</dependentAssembly><br />
</dependency><br />
</assembly>
Since then, my listview doesn't accept item background colours i apply using:
if(lplvcd->nmcd.lItemlParam==1){
lplvcd->clrText = RGB(0,0,0);<br />
lplvcd->clrTextBk = RGB(240,240,255);<br />
}<br />
When i remove manifest, all looks okay, but when i apply it again - colours are missing.
Any idea ?
Regards,Paul.
|
|
|
|
|
I have both VC++ 6.0 and VC++ 7.1, and I notice that my 7.1 version has icons for source control that indicates when a file is locked by another user VS locked by the current user.
Where as VC++ 6.0 only has an icon showing it's locked.
See following screen shot:
http://code.axter.com/SCC_for_vc71_and_vc60.JPG
I'm developing an SCC AddOn for VC++, and I want to know if there is any way of adding the blue lock icon to VC++ 6.0, and if so, how.
I tried using Spy++ to find the tree window handle, but didn't have much luck.
I appreciate any leads to help solve this.
Thanks
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
ompiling...
MP3PLAYERDlg.cpp
Linking...
MP3PLAYERDlg.obj : error LNK2001: unresolved external symbol "public: class CBasePin * __thiscall CAsyncReader::GetPin(int)" (?GetPin@CAsyncReader@@QAEPAVCBasePin@@H@Z)
MP3PLAYERDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CAsyncReader::GetPinCount(void)" (?GetPinCount@CAsyncReader@@UAEHXZ)
MP3PLAYERDlg.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __stdcall CBaseFilter::NonDelegatingRelease(void)" (?NonDelegatingRelease@CBaseFilter@@UAGKXZ)
MP3PLAYERDlg.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CAsyncReader::~CAsyncReader(void)" (??1CAsyncReader@@UAE@XZ)
MP3PLAYERDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall CAsyncReader::CAsyncReader(char *,struct IUnknown *,class CAsyncStream *,long *)" (??0CAsyncReader@@QAE@PADPAUIUnknown@@PAVCAsyncStream@@PAJ@Z)
strmbasd.lib(dllsetup.obj) : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)
strmbasd.lib(dllentry.obj) : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)
strmbasd.lib(dllsetup.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)
strmbasd.lib(dllentry.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)
Debug/MP3PLAYER.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
MP3PLAYER.exe - 10 error(s), 0 warning(s)
these are the errors i have got when i tried to execute my project....i am doing a project to create an mp3 player
which reads the file bit by bit.....
i am beginneer...i know little about vc++.
so give me a detailed description....
included libraries are strmbasd.lib Vfw32.lib winmm.lib ....
i am using the memfile in directx8 to read data bit by bit..
please give me a solution... if any explanation needed please ask me...
sebin
|
|
|
|
|
sebinfrancis wrote:
these are the errors i have got when i tried to execute my project
wrong. these error happened when trying to link the compiled object files of your project.
sebinfrancis wrote:
so give me a detailed description....
select one error in the output window where you quoted this, and puch F1... msdn exist for that...
ok, now, what does the error say ?
let's take the first one :
MP3PLAYERDlg.obj :
error LNK2001:
unresolved external symbol "public: class CBasePin * __thiscall CAsyncReader::GetPin(int)"
the linker says that there is a call to the member function CAsyncReader::GetPin(int) into MP3PlayerDlg.obj (see the corresponding .cpp file), but it doesn't know such a function...
and all the errors you get are of this style...
so, did you well #include the headers ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi there
I need to find a way to reliably detect the date and time of the last startup/reboot of Windows.
I have found some information that could be used on Win95, Win98, and WinME platforms (checking the date and time of the registry backup files c:\windows\system.da0 and c:\windows\user.da0, or the last accessed time of autoexec.bat).
Is there a similar method that works on all versions of Windows? If not, is there a similar method on WinNT, Win2k, and WinXP?
Cheers,
Johan
|
|
|
|
|
Johan - I'm pretty sure for WinNT, Win2k, WinXP you can query a PDH (Performance Data Helper) Value called 'System Up Time', but I dont have any code here to prove it
Garth
|
|
|
|
|
|
Yes there is a gettickcount() function to calculate the uptime
i think it will return the values in seconds. you can calculate it
accordingly.
any further details refer WMI classes in msdn
Pradeep
|
|
|
|
|
Milliseconds actually.
This will be the simplist, most universal approach, though the DWORD counter will rollover every 49.7 days, so you'll have to take that into account.
modified 12-Jul-20 21:01pm.
|
|
|
|
|
QueryPerformanceCounter and QueryPerformanceFrequency will help. They have a roll-over that is much much more than 49 days.
Don't try it, just do it!
|
|
|
|
|
Thank you everyone for your kind responses
You do however not answer my question, I want to detect the date and time of the last startup/reboot, not the time elapsed since then.
Maybe I should have been a bit more informative, I am adding this code as part of a software protection system, and I want to find a way to detect of the system time has been changed to a valid day within their evaluation period.
On the old Win architecture, this works perfectly by checking the files mentioned above. But how can this be achieved on the NT platform?
/Johan
|
|
|
|
|
I need to write a class which manipulates char in Unicode form.
So i need materials related to implementation techniques for unicode using c++ class..
thanx in advance
|
|
|
|
|
How about using std::wstring instead?
Painted on the side of a dog trainer's van: SIT HAPPENS
|
|
|
|
|
No NO my question is
i need to write a class which deals with unicode...
If i store a particular char in the class, using some functions i should be
able to say its catagoreis.............
there are nearly 30-40 catagories....
so i need to catagory the char which is stored in my class...?
any guess?
|
|
|
|
|
hi,
i'm doing a project where i hav a transmitter in a place n a receiver connected to the soundcard of the system.now my reciver is one which always does hav noise n whenever i click on a button in the transmitter i can transmit the signal.now the problem is my pgm has to detect when the transmitter is switched on n when it is off so tht it can record the voice.i'm struck.plzz help.imp as i'll hav to submit it sonn.
thnx.
aania
|
|
|
|
|
Hello...
I am trying to make a WYSIWYG editor and for that I am using the MSHTML control (in a win32 application).
Well it works fine you can set properties of the text with the build in functions...
Than I get a text range (with IHTMLTxtRange) (i can get the text range with no problem) and modify it using pasteHTML (i am doing that to apply font properties...) (i can do what I want but maybe there is some problem here).
Well after that I cannot change anything with the built in functions... But my functions continue working...
I am thinking about the selection range... Do I have to select the whole document and out it in a range in order to edit it with the built in functions?
What may be the problem?
Thank you very much in advance for your answers...
Well... I am a beginner ...
|
|
|
|
|
Problem solved...
Well... I am a beginner ...
|
|
|
|
|
My question is related to client/server programming;
Can we communicate between client and server which have benn developed using different technologies, e.g. client using a Winsock control and server using CSocket class, or say raw winsock apis, MFC etc.
What about different plateforms
|
|
|
|