|
hello every1!
I am creating a simple static library file. I hava a string table in a library. These is a function getString which retrieves string from a string-table.
Now i have to use LoadString function in getString.
int LoadString( HINSTANCE hInstance,<br />
UINT uID,<br />
LPTSTR lpBuffer,<br />
int nBufferMax<br />
);
Then in this case what should be the first argument for the LoadString(). n how should i get this hInstance??
Thanks in advance!
|
|
|
|
|
hi,
use AfxGetInstanceHandle() to get the first value of LoadString()
chawda
|
|
|
|
|
In addition, note that instead of ::LoadString you can use the similar member of CString class. In this case is easier to load strings of any length.
-- modified at 5:57 Tuesday 27th June, 2006
|
|
|
|
|
hi!
Thanks for the replies!
there is another problem! I am bulding this project without MFC support. So I selected New->Win Static Library. Also i unchecked MFC support.
Now while calling this getString method, i need handle for the application which is using the library. When i tried defining getString prototype, it gives me error as HINSTANCE is undefined identifier.
I am defining getString as
class CCommonStrings <br />
{<br />
public:<br />
void GetString(HINSTANCE hinst);<br />
CCommonStrings();<br />
virtual ~CCommonStrings();<br />
<br />
};
what should be done here?? Is HINSTACE only avlble in MFC?
|
|
|
|
|
So you actually are building a static library, and not an MFC static DLL. In this case, I think you can use
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
The HINSTANCE type is defined in a Windows header file. You should include it after stdafx.h :
#include "stdafx.h"
#include <windows.h>
Or better put #include <windows.h> into stdafx.h and rebuild the project.
|
|
|
|
|
hi viorel!
thx a lot buddy! that solved my problem!
|
|
|
|
|
|
hello guys!
i am facing new problem now!
I checked everything but i am getting error 1814
i.e "The specified resource name cannot be found in the image file. "
Someone told me that we can not use string tables in a static library. And if we use it, then we have to include that string table in the apllication along with a library.
is it true!
|
|
|
|
|
if i keep menu name as file in that we have items like open, exit,name1.if i want to change the name1 to some other name what should i do
|
|
|
|
|
I think ModifyMenu can help. Something like this:
::ModifyMenu( hMenu, ID_MY_MENU_ITEM, MF_BYCOMMAND, ID_MY_MENU_ITEM, "New string");
|
|
|
|
|
BTW. Why do you want to keep menu item strings in files?
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
I think he wants to put the file name in the menu, like a MRU list.
|
|
|
|
|
iam doing just like in windows media player.in meid player once we open any application then the path of that application i sstroed in the menu.when we click again we
should run that program.
|
|
|
|
|
on equestion you want to save paths in a file
whitesky
|
|
|
|
|
|
I think registry is good instead file
whitesky
|
|
|
|
|
If you want MRU files list, just create an SDI/MDI application using MFC AppWizard.
This functionality will be implemented by default in framework, and nomore sweat for you.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Perhaps you should use SUBSTRING function:
SELECT SUBSTRING(name, 1, 3) FROM table1 ...
Alternatively you can obtain the substring in C++ after you get the entire name from database.
|
|
|
|
|
select SUBSTRING(name, 1, 3) from table1 where fname="name"
|
|
|
|
|
hi sir (again)
sir tell me but is difference between WM_paint and wm_erasebkgnd
/////////////
plz sir its request that tell me one function daily only one i think i does not take much time plz.........plz.........
Ashish Dogra
MCA
Noida
|
|
|
|
|
plz sir give me some response
plz.............its request
Ashish Dogra
MCA
Noida
|
|
|
|
|
Hello,
In Vista, which kind of IPC is better? who can tell me?
In Vista, I tried the "file mapping", but it seems not work at all.
Best Regards,
|
|
|
|
|
Hi
I create a frame and rotate the screen in 270 degree.
But if I wish when I set setting->screen->orientation->portrait,
the screen will not rotate until I close the fram.
What could I do for the question??
Any suggestion is useful!! Thanks!!
|
|
|
|
|
Hi all,
Im creating a .dll using ATL. Recently I have got to add the file operation part to it but as soon as I did it, it started to throw error saying :
" Drawing Assertion failed
Program : c:\windows........
File : fprintf.c
Line :55
Expression : (str!= NULL)
.................. "
This is the part of code which I'm using. It works well as far as I'll keep
fprintf(......);
statement away. But as soon as I included that its throwing error.
<br />
STDMETHODIMP CYourClass::YourATLMethod(BSTR Filepath, BSTR* ReturnString)<br />
{<br />
_bstr_t LbstrFilepath = Filepath;<br />
<br />
XMP_VersionInfo version;<br />
SXMPMeta::GetVersionInfo ( &version );<br />
FILE * sLogFile=fopen( "XMPLog.txt", "wb" ); ;<br />
fprintf ( sLogFile, "Version : %s\n" , version.message );
please guide me. where and why it is throwing error. What I'm supposed to get rid of this.
Regards,
Arun
|
|
|
|
|
Is sLogFile a valid file pointer? Per the assertion, it is NULL .
What type is version.message ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|