|
void functionF(BSTR bstr)
{
CComBSTR cBstr = bstr;
CString str(bstr);
CString strAppend;
strAppent = str + CString(bstr); //Appending Strings
strAppend += str;
//Similiar with CComBSTR and _bstr_t
}
|
|
|
|
|
hrm.. seems the whole problem is that i was listing the classname in front of the function like:
void __stdcall CFpsPayTaxxApp::FindBankName(BSTR strFilename, BSTR strRoutingNumber, BSTR strBankName)
i took off the classname in front of the function and it now the vars come in fine..
void __stdcall FindBankName(LPSTR strFilename, LPSTR strRoutingNumber, LPSTR strBankName)
wierd stuff.
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hello,
I have never tried to load a dialog box from a dll.. I have created a Static MFC DLL and created a dialog within the dll.. I used this to export the class hoping that this would allow me to use the dialog..
class AFX_EXT_CLASS CSettingsDlg : public CDialog
{
public:
CSettingsDlg();
~CSettingsDlg();
enum { IDD = IDD_SETTINGS }; <------HERE
..... BLAH BLAH
The problem is when I add the .lib, .h and dll to the other application and try to compile it I get an error on this line..
enum { IDD = IDD_SETTINGS }; <--
Any ideas?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
You need to set the resource handle to the dll the switch it back again;
you should see a line of code like this somewhere in your dll, probably near DllMain function:
static AFX_EXTENSION_MODULE MyDLL = { NULL, NULL };
define a
HMODULE MyModuleHandle;
globally;
in DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
...
new CDynLinkLibrary(MyDLL);
//Add this line
MyModuleHandle = MyDLL.hModule;
}
then before you create your dialog, do something like this:
HINSTANCE pPreviousInstance = AfxGetResourceHandle();
AfxSetResourceHandle(MyModuleHandle);
m_pMyDialog = new CMyDialog();
...
AfxSetResourceHandle(pPreviousInstance);
this should solve that problem..
"Life begins at 140"
|
|
|
|
|
Try adding:
#include "resource.h"
to the top of the header file (SettingsDlg.h).
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Hello!
How can i change a menu name on runtime. With the menu-name i mean by example "File", "Edit" or "Help". Submenu's is not a problem for me because they have a ResourceID, but the menu's that i want to change on runtime does not have that, or i can't find them?
Thanks for helping me.
|
|
|
|
|
I haven't tried this but it should work.. where 0 is the first item on the menu like "File".
CMenu *pMenu = GetMenu();
CString csMnuStr;
pMenu->GetMenuString(0, csMnuStr, MF_BYPOSITION);
pMenu->ModifyMenu(0, MF_BYPOSITION, 0, "New Text");
DrawMenuBar();
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Thanks!
Now automaticly all the menu-item texts goes through a translate function. So that my program works with different language's.
<br />
CMenu *pMenu = GetMenu();<br />
CMenu *pSubMenu;<br />
CMenu *pSubSubMenu;<br />
<br />
CString csMnuStr;<br />
<br />
for(int i=0; pMenu->GetMenuState(i, MF_BYPOSITION) != -1; i++)
{<br />
if(pMenu->GetMenuString(i, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pMenu->ModifyMenu(i, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubMenu = pMenu->GetSubMenu(i);
<br />
if(pSubMenu == NULL)
continue;<br />
<br />
for(int j=0; pSubMenu->GetMenuState(j, MF_BYPOSITION) != -1; j++)
{<br />
if(pSubMenu->GetMenuString(j, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubMenu->ModifyMenu(j, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubSubMenu = pSubMenu->GetSubMenu(j);
<br />
if(pSubSubMenu == NULL)
continue;<br />
<br />
for(int k=0; pSubSubMenu->GetMenuState(k, MF_BYPOSITION) != -1; k++)
{<br />
if(pSubSubMenu->GetMenuString(k, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubSubMenu->ModifyMenu(k, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
} <br />
}<br />
}<br />
DrawMenuBar();<br />
|
|
|
|
|
Thanks!
Now automaticly all the menu-item texts goes through a translate function. So that my program works with different language's.
<br />
CMenu *pMenu = GetMenu();<br />
CMenu *pSubMenu;<br />
CMenu *pSubSubMenu;<br />
<br />
CString csMnuStr;<br />
<br />
for(int i=0; pMenu->GetMenuState(i, MF_BYPOSITION) != -1; i++)
{<br />
if(pMenu->GetMenuString(i, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pMenu->ModifyMenu(i, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubMenu = pMenu->GetSubMenu(i);
<br />
if(pSubMenu == NULL)
continue;<br />
<br />
for(int j=0; pSubMenu->GetMenuState(j, MF_BYPOSITION) != -1; j++)
{<br />
if(pSubMenu->GetMenuString(j, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubMenu->ModifyMenu(j, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubSubMenu = pSubMenu->GetSubMenu(j);
<br />
if(pSubSubMenu == NULL)
continue;<br />
<br />
for(int k=0; pSubSubMenu->GetMenuState(k, MF_BYPOSITION) != -1; k++)
{<br />
if(pSubSubMenu->GetMenuString(k, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubSubMenu->ModifyMenu(k, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
} <br />
}<br />
}<br />
DrawMenuBar();<br />
|
|
|
|
|
Thanks!
Now automaticly all the menu-item texts goes through a translate function. So that my program works with different language's.
<br />
CMenu *pMenu = GetMenu();<br />
CMenu *pSubMenu;<br />
CMenu *pSubSubMenu;<br />
<br />
CString csMnuStr;<br />
<br />
for(int i=0; pMenu->GetMenuState(i, MF_BYPOSITION) != -1; i++)
{<br />
if(pMenu->GetMenuString(i, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pMenu->ModifyMenu(i, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubMenu = pMenu->GetSubMenu(i);
<br />
if(pSubMenu == NULL)
continue;<br />
<br />
for(int j=0; pSubMenu->GetMenuState(j, MF_BYPOSITION) != -1; j++)
{<br />
if(pSubMenu->GetMenuString(j, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubMenu->ModifyMenu(j, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubSubMenu = pSubMenu->GetSubMenu(j);
<br />
if(pSubSubMenu == NULL)
continue;<br />
<br />
for(int k=0; pSubSubMenu->GetMenuState(k, MF_BYPOSITION) != -1; k++)
{<br />
if(pSubSubMenu->GetMenuString(k, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubSubMenu->ModifyMenu(k, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
} <br />
}<br />
}<br />
DrawMenuBar();<br />
Willem
|
|
|
|
|
try DrawMenuBar()
CodeTheDreams();
|
|
|
|
|
Within a few days I'll begin to submit my arguments.
|
|
|
|
|
Mr. Andrea wrote:
Within a few days I'll begin to submit my arguments.
On what subject ?
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Why?
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Hi,
i like to save received data files (.pmj) from a scanner serially numbered on my disc (001.pmj, 002.pmj, ...) I know i must work with a loop and a variable, but it is too tricky for me.
Untill now i do the following:
// Save the file...
if (r)
{
CString fileName = "e:\\data\\001.pmj";
SavePMJStream(fileName);
}
Thanks for help, Mark
|
|
|
|
|
use a int variable to hold the counter ( file number )
use CString::Format to format the counter into a string.
use the for loop to increment the counter and format filename as a string, and pass it to the SavePMJStream .
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
macmac38 wrote:
Untill now i do the following:
// Save the file...
if (r)
{
CString fileName = "e:\\data\\001.pmj";
SavePMJStream(fileName);
}
----------------------------
CString csPath, csFileName;
int nLastFile;//Keep SomeWhere (Registry/file)
csPath = "e:\\Data\\";
if (r)
{
csFileName.Format("%03d", ++nLastFile);
csPath +=csFileName;
SavePMJStream(csPath);
}
Why Not THIS.?????
CodeTheDreams();
|
|
|
|
|
I use a CListCtrl on a dialog. The problem is that the background of the icons is somehow changed to black when the dialog pops up. But the background is supposed to be transparent.
Who knows how to prevent this?
This is the code that i use:
CMyDlg::OnInitDialog()<br />
{<br />
m_imageList.Create(32, 32, ILC_COLOR4, 2, 2);<br />
<br />
for(int i=0; i<2; i++)<br />
{<br />
int nID = GetIconID( i );<br />
<br />
HICON hIcon = ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nID),<br />
RT_GROUP_ICON), MAKEINTRESOURCE(nID));<br />
<br />
m_imageList.Add(hIcon);<br />
}<br />
<br />
m_listCtrl.SetImageList(&m_imageList, LVSIL_NORMAL);<br />
<br />
for(int nIndex=0; nIndex<2; nIndex++)<br />
{<br />
m_type.InsertItem(nIndex, "some text", nIndex);<br />
<br />
nIndex++;<br />
}<br />
}
Thanks in advance,
Jochem
|
|
|
|
|
not sure but it could be this
Jochem wrote:
m_imageList.Create(32, 32, ILC_COLOR4, 2, 2);
try using ILC_COLOR16|ILC_MASK instead of ILC_COLOR4
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Adding ILC_MASK did the trick
|
|
|
|
|
Hello,
I am creating a DLL, which I get a set of data, while within every data, there are several kinds of data type, something like:
Data1
int i=2;
String s="John";
Date d="1980/10/10";
Date3
int i=3;
String s="kevin";
Date d="2003/11/05";
Data3
...
...
I am trying to load these data in memory and offer method like GetData() to application programmer who is going to use my DLL.
Can someone give me little hint that which type should I use to store these day?
Is it correct that I use struct to store each "Data", and create a template to store all these "Data"s?
Thanks!
|
|
|
|
|
A structure lets you define a new data type that is a collection of other data types.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
One solution is a class if the design fits. Otherwise, use a structure as the other members has mentioned.
Kuphryn
|
|
|
|
|
Hi Kuphryn, thanks for your reply!
Then if I use structure, since I have many "structure" for many datas in the application, i.e. Data1, Data2, Data3,etc.. How could I access individual structure? Should I use template to store these structure?
|
|
|
|
|
Given that you store the same set of class or structure objects in a file, one solution is to use read() along with seekg(sizeof(object)).
Kuphryn
|
|
|
|
|