|
-
Jul 28th, 2001, 03:48 PM
#1
Thread Starter
Hyperactive Member
how do i load a string out of a string table ????
how do i load a string out of a string table by its id number??? NO MFC!!!!
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 04:09 PM
#2
Monday Morning Lunatic
Code:
#include <windows.h>
#include <tchar.h>
#include <string>
using namespace std;
typedef std::basic_string<TCHAR> tstring;
tstring LoadResString(UINT uID, HMODULE hMod) {
TCHAR pcBuf[1025];
LoadString((hMod ? hMod : GetModuleHandle(NULL)), uID, pcBuf, 1024);
return pcBuf;
}
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 04:35 PM
#3
Thread Starter
Hyperactive Member
help, it says theres no acceptable conversion
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 04:38 PM
#4
Monday Morning Lunatic
Bloody non-portable-Unicode-aware Philistines 
Code:
string LoadResString(UINT uID, HMODULE hMod) {
char pcBuf[1025];
LoadStringA((hMod ? hMod : GetModuleHandle(NULL)), uID, pcBuf, 1024);
return pcBuf;
}
Ignore the other one completely
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 04:44 PM
#5
Thread Starter
Hyperactive Member
it still isnt working, heres what im doing
pcString = LoadResString(id, hInst);
error D:\C++\Vbdll2\stringdll.cpp(20) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 04:48 PM
#6
Monday Morning Lunatic
*choke* *gag*
Oooopsie 
Code:
string x = LoadResString(IDS_MYSTRING, hInst);
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 04:58 PM
#7
Thread Starter
Hyperactive Member
sorry with the errors, got a nother one, if you didnt know im new at c++ ,,please clarafy how to use LoadResString; i want the string LoadResString returns to be put into pcString so it can be sent to my vb app ( this is a dll project)
void __stdcall GetString(char *pcString, long id)
{
string pcString = LoadResString(id, hInst);
}
error C2082: redefinition of formal parameter 'pcString'
Last edited by Cmdr0Sunburn; Jul 28th, 2001 at 05:11 PM.
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 06:56 PM
#8
Monday Morning Lunatic
If you want to use it from VB then why not call the LoadResStringA API function on its own from VB?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 06:59 PM
#9
Thread Starter
Hyperactive Member
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:02 PM
#10
Thread Starter
Hyperactive Member
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:02 PM
#11
Monday Morning Lunatic

LoadStringA Typo there 
It's the actual API function you call.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 07:03 PM
#12
Thread Starter
Hyperactive Member
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:09 PM
#13
Thread Starter
Hyperactive Member
how do i convert this; LoadStringA((hMod ? hMod : GetModuleHandle(NULL)), uID, pcBuf, 1024) to vb??
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:14 PM
#14
Monday Morning Lunatic
VB actually has a built-in function for this:
VB Code:
Dim sThing As String
sThing = LoadResString(101) ' Or any other valid ID
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 07:16 PM
#15
Thread Starter
Hyperactive Member
nooooooooooooooooooo i want to call it from the dll!
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:18 PM
#16
Monday Morning Lunatic
www.vbapi.com should have a definition/example for this.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 07:27 PM
#17
Thread Starter
Hyperactive Member
i would use a vbdll but creating activex doesnt work on my win2000, Pleeese Pleassssssseeee can you make me a c++ dll that returns the specifyed res string to the vb app please, ill do any thing for you!
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:32 PM
#18
Monday Morning Lunatic
Is the resource stored in the DLL or the EXE?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 07:36 PM
#19
Thread Starter
Hyperactive Member
a win32 dll , the res string table is in the dll,
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:44 PM
#20
Monday Morning Lunatic
VB Code:
Private Declare Function LoadStringA Lib "kernel32" (ByVal hInstance As Long, ByVal uID As Long, ByVal lpBuffer As String, ByVal nBufferMax As Long) As Long
Private Declare Function LoadLibraryA Lib "kernel32" (ByVal lpFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hModule As Long) As Long
Private Sub Form_Load()
Dim hMod As Long
Dim sString As String
hMod = LoadLibraryA("the_dll")
sString = Space(255)
LoadStringA hMod, 101, sString, 255
FreeLibrary hMod
End Sub
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 07:52 PM
#21
Thread Starter
Hyperactive Member
vb error = cant find dll entry point loadstringA in kernel32
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 07:54 PM
#22
Monday Morning Lunatic
Umph...sorry I just typed that straight. Try user32 instead.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 28th, 2001, 07:56 PM
#23
Thread Starter
Hyperactive Member
MUHAHAHAHA IT WORKS!!!! Thx i spend over 12 hours strait workin on trying to load a res string from a c dll! thx a million
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 28th, 2001, 08:00 PM
#24
Monday Morning Lunatic
No problem. Friendly hints for next time:
1. State your entire problem clearly in the first post
2. Browse around MSDN, vbapi.com, vbworld.com
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 29th, 2001, 10:18 AM
#25
Thread Starter
Hyperactive Member
can the code you posted be applyed to bitmaps, icons, custom resources??? if so how?
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Jul 29th, 2001, 10:29 AM
#26
Monday Morning Lunatic
The LoadImage function (actual name: LoadImageA) works in the same sort of way. PlaySound will accept the value returned from LoadLibrary too.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|