|
I have a file, data.dat, that contains a memory map that is used in an other software solution written in an other language. The file contains information in the format:
Address1 0x0000
Address2 0x1000
Address3 0x2000
Address4 0x3000
...
I need to access this file in runtime from my program written VC++ Express. I would like to include the data.dat-file like a resource file when buildning my program. My question is:
How do I include this file as a resource-file and how do I access the file and read information from it? Code examples would be greate.
Best regards
/Desmo
|
|
|
|
|
Add the file as a custom resource.
Then use FindResource, LoadResource and LockResource in that order.
This will give you a pointer from which you can read the data.
« Superman »
|
|
|
|
|
Thanks for the reply,
Unfortunately I can't find what namespace to use or what files to #include to get access to those functions? Do I need .NET framework 3.0 installed?
Thanks in advanced
/Desmo
|
|
|
|
|
Hi all:
I just got 120 (GetLastError()) from GetCurrentDirectory() on WinME, that means the API doesn't implemented. Is there any other reason this call may fails? and any other substitute?
|
|
|
|
|
Are you sure GetLastError returned 120? The documentation says GetCurrentDirectory works on Windows ME too. Here[^] the link is. (See the requirements section there). Use FormatMessage and display your error right there.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: Are you sure GetLastError returned 120?
Yes, I noticed the requirement section, and that was what make me wonder. I try to append the API with "::" but to no avail so far.
But I did see the two functions exported form Kernel32.dll from WinME:
GetCurrentDirectoryA and W
|
|
|
|
|
Can you please post the code?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
TCHAR tszSetupDir[MAX_PATH] = {0};<br />
GetCurrentDirectory(MAX_PATH, tszSetupDir);
|
|
|
|
|
Note that if your project is unicode aware, then the unicode version of this function,
GetCurrentDirectoryW will be called. You will need MLU (Microsoft layer for unicode) installed on your Windows ME machine.
PS: If you don't care for unicode, you will have to make an explicit call to
GetCurrentDirectoryA
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Exactly, GetCur...A works! Thanks a lot.
|
|
|
|
|
LiYS wrote: Exactly, GetCur...A works! Thanks a lot.
I would strongly suggest not to use ANSI version of a call in a unicode project. Install MLU and use the Unicode version. The major harm in getting it done this way is that if the path contains unicode characters, this call will fail again.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
OK, thanks for reminding me!
|
|
|
|
|
|
S.V.RAJKUMAR wrote: give the dll to Access the Records in Dialog based
Apllication ?
WTF do you mean? A dll to access the records in a dialog based app? WTF man.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
You are probably an experienced VB programmer. The reason I say that is that all DLLs created by VB are COM/ActiveX objects. C++ uses Windows in a more direct manner and can often create DLLs that are not COM/ActiveX objects. When communicating with C++ programmers, if you say DLL when you mean to say COM/ActiveX object, then you are more likely to confuse us.
There are many ways to use MFC for databases. You should read the documentation. There is (was?) even a MFC tutorial about database programming using MFC.
|
|
|
|
|
See if this article helps any.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
Hi,
I want to get the manufacturer assigned serial number of hard disk. Please tell me how can i get using C++. I have tried to read the 4 bytes at 27h but it always gives the same number on all the hard disks. Kindly guide me in this regard. Your help will be highly appreciated.
Thanks & Regards,
Wasif Ehsan.
|
|
|
|
|
User the WMI class Win32_PhysicalMedia for getting this information.
« Superman »
|
|
|
|
|
No boss. I need to use simple C++. I can't include advanced features like WMI. Do you have any concept how to get it? Please help me. I am badly in need of it.
Regards,
Wasif Ehsan.
|
|
|
|
|
does GetVolumeInformation() is of any use to u?
nave
|
|
|
|
|
Naveen R wrote: does GetVolumeInformation() is of any use to u?
i dont think it will help him. it will give the volume serial number that is given by the windows when u format the drive. the volume serial number is not a permanent one. it will change every time u format the drive. the volume serial number can be changed programatically .
The Manufacturer's serial number can't be retrieved by GetVolumeInformation() . The manufacturer's serial number and model number is embedded in the Firmware of the disk. it is a permanent one and can't be changed programatically since it is kept in ReadOnly area of the disk. U can use WMI classes or even SMART (Self Monitoring Analysis And Reporting Technology)functions to retrive the serial number. Reading through the IO ports may be another method but its a very unreliable one i suppose. There are plenty of examples that are available on the net but the code is in VB. Use Google and see if u can get some examples in C++. Surely the link given by WhiteSky will help.
Good Luck
vijay.
|
|
|
|
|
|
What operating system is this for? If it is not for Windows then it would help to say so.
|
|
|
|