|
BSTR* stoBSTRp(string input)
{
BSTR bob;
bob = stoBSTR(input); //lets assume I have have stoBSTR vorking fine (takes in a string and returns a BSTR)
return &bob;
}
so you are saying something like this?
|
|
|
|
|
No, of course not. But
BSTR* stoBSTRp(string input)
{
BSTR * bob = new BSTR;
bob = stoBSTR(input); //lets assume I have have stoBSTR vorking fine (takes in a string and returns a BSTR)
return bob;
}
would work fine. I didn't expect this to be the question though, I'd assume he doesn't have to *return* a BSTR*, but rather pass one in to something. The point of my suggestion was more to see if I was missing something as anything.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi
How do you set the number of tabs on a tab control and how do you insert objects into each tab? Is this done with an event handler when the form loads, and if so what event? I am a bit of a newby to VC++ being so used to the way VB hands it out on a plate.
Live each day like yer first...
...write songs like there yer last
Cheers
Craig
|
|
|
|
|
Create a variable from the tab control, and in OnInitDialog use the methods of the tab control to add items, etc.
Here's an example from my program:
m_Tabs.InsertItem(0,"Combined");
for (int i = pDoc->m_LayerManager.GetLayerCount(); i>0; i--)
{
CString s;
s.Format("Layer %d", i);
if (pDoc->m_LayerManager.GetLayer(i)->layerName .GetLength()<2)
m_Tabs.InsertItem(1, s);
else
m_Tabs.InsertItem(1, pDoc->m_LayerManager.GetLayer(i)->layerName );
}
m_Tabs.SetItemSize(CSize(60,20));
The important bit is that Insert Item adds an item, the count is how many you have added this way, and SetItemSize sets the size of a tab. If you don't have the MSDN CD's, go to msdn.microsoft.com to get full documentation on the CTabCtrl methods.
Hope that helps...
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Where does pDoc come from and what does it point to? I do not have pDoc declared so i get an error when i compile.
Live each day like yer first...
...write songs like there yer last
Cheers
Craig
|
|
|
|
|
I'm sorry, I should have trimmed irrelevant code. The point is the calls to InsertItem, the rest of it will not compile ( it's a pointer to the document ).
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Have i dont this right? It crashes when i run it
BOOL CRemoteControlDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CTabCtrl m_Tabs;
m_Tabs.InsertItem(0,"Combined");
return TRUE; // return TRUE unless you set the focus to a control
}
Live each day like yer first...
...write songs like there yer last
Cheers
Craig
|
|
|
|
|
First off, use the dialog editor to add the tab control to the dialog. Then use the class wizard to add a member variable to your dialog class.
Click on the Member Variables tab on the Class Wizard Dialog, find the control named IDC_TAB1, and press the Add Variable button. Make sure the variable is a Control of type CTabCtrl, and name it whatever you like (m_Tabs).
Then in your OnInitDialog() function, call the InsertItem() function with the member variable.
m_Tabs.InsertItem(0,"Combined");
The problem was that when you created the CTabCtrl in your program, it was not really a control at all.
CTabCtrl m_Tab; //Just creates the class, not the control!!
|
|
|
|
|
Imagine there is an edit control on a dialog. The variable for that edit control is m_eEdit.
Have a look at this:
COleDateTime oledt;
oledt = COleDateTime::GetCurrentTime();
oledt.Format("%X");
m_eEdit.SetWindowText(oledt);
When compiling and so... the are no errors... BUT! the result of the time that is to be seen in
the edit control looks like this: AD0G135
Why!
/*
BETA
*/
|
|
|
|
|
Hi,
I don't know how did your code compile!!! , you must have type casted it .
Format will return the formated string.
Any way
Try this
m_eEdit.SetWindowText(oledt.Format ("%X"));
Cheers
Alfadhly
/*
It is Illogical to define an inventor by his invention
*/
|
|
|
|
|
How do I get a Bitmap and a String on the same Menu Item??
The menu is created at runtime using .CreateMenu() and CreatePopupMenu().
I'm using .AppendMenu(...) to add the items but I can only add MF_STRING or MF_BITMAP.
I tried to .AppendMenu(..) then .ModifyMenu(..) but still no luck.
Once the Menu is created it is ran through a function which sets the whole Menu to Ownerdraw but the Bitmap ain't coming up.
please throw some light into the sutuation if you can.
regards,
pgudge
|
|
|
|
|
I want to create a ActiveX Control in VC++, in which i want to use custom class(Complex) that is defined in a dll file(Complex.dll), that dll file is created in Visual basic .
I want to use that class & their properties & methods in the my activeX Control in VC++. Please help me on above as earliest. please let me know what is the best suitable way to do this.
My aim is to create a activex control which have a property of Complex type Complex class must have real & imagenary values & offcource all Complex type features.
please let me know how this is possible.
Satyen
|
|
|
|
|
I want to use doubleclick on my multiple selection listbox..
None of the CListBox class members seem to provide a way of telling which entry was doubleclicked, only which ones are selected.
Any hints?
Thanks,
Gustav
|
|
|
|
|
Errr.. if it is doubleclicked, the specific item is highlighted too
so do the following:
in the doubleclick event :
int selected;
CString itemdata;
selected=m_listbox.GetCurSel();
m_listbox.GetText(selected,itemdata);
and then you have the text of the doubleclicked item in the CString itemdata;
|
|
|
|
|
Is it possible to overload a function in another DLL?
Let's say that i would like every program on my computer to
call my own CWnd::CalcWindowRect or something like that?
I think that i found some code that describes how to do
this. But i don't understand how to use it.
Is there someone that knows how this is done, and maybe have
a simple example?
|
|
|
|
|
does itoa and ltoa work when the value is 0?
for eg:
long d = 0; // or int value
char* stop;
char* sResult;
ltoa(d, sResult, 16); //this line generates error
is the error due to the value of d being 0 or are there other reasons?
Please help. Thanks!
|
|
|
|
|
You might want to alloc some memory for sResult before using it...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi all,
I have a weird problem. When I debug my application in Visual Studio
the first time, everything works fine. When I press F5 again my
application has an access violation when I move the mouse over the
commandbar. Sometimes after stopping the debug, the visual studio
crashes also.
I use Visual Studio 6, WTL 3.1 and running on Windows98.
Franky
|
|
|
|
|
I've seen this, I think, or something like it on win98. Sometimes something seems to go squirrely with the common control dll (?) during a VC session and as soon as the mouse moves over a toolbar button in my app it faults. I think I've seen it when I switch to a release build.
Once this occurs, toolbars in other apps can start to exhibit the same behavior - which makes it hard to even use explorer.
Rebooting usually straightens things out.
My 98 system is a very 'feature packed' mixture of DLL pudding at this point, still proudly displaying april 98 on bootup. I think it was upgraded from the beta. Plus, it supports two monitors, each with its own driver, which might have an impact.
The prime suspect in my case might be a rollback from IE 5.0 that occurred sometime back, and left IE a bit crippled - thats why I suspect some sort of comctl32 messup - which certainly could impact on toolbar functionality, styles etc - though I don't know if I've seen this happen for the command bar.
Does this always occur? If you fire up your machine and don't open IE, going straight to VC instead, does that make any difference?
|
|
|
|
|
Thanks Tim for your reply. While searching the net I've found several identical questions about this problem. It seems that it only occurs on Win98. The problem is that comctl32.dll uses a global adress somewhere for the toolbar. This address invalidates when you debug an application. A solution is: before starting the debugger: run a application and activate a tooltip on a toolbar. Keep this application open while your debugging. This way the global adress keeps the same for as long as the application is open. This solution works fine for me now.
|
|
|
|
|
pls any one can mail me key used to unloak advanced MFC Progamming tutorial from formatics.com
Actually i been to this site, but its closed
thanks in advance
|
|
|
|
|
@5674093020-
|
|
|
|
|
At $60 you'd be better off buying a book, but I'll be sorely disappointed if anyone here is hypocritical enough to help you steal it. Even if their site is down, their copyright remains.
|
|
|
|
|
I guess I shouldn't be surprised - the anonymous posters strike again.
|
|
|
|
|
At $60 you'd be better off buying a book, but I'll be sorely disappointed if anyone here is hypocritical enough to help you steal it. Even if their site is down, their copyright remains.
|
|
|
|