|
You can do it by using CCtrlList class's SetBkImage() function.
Chintan
C.R.Naik
|
|
|
|
|
I found out that, by default, I cannot pass CString objects in to(or out of) an MFC extension DLL, no matter it is passing by value, by reference or by pointer, doing so will guarantee a run-time "user break point reached" error, if I look into the debug context I find the error was caused by CString destructor.
Although I can get around it by using TCHAR arrays instead of CString, that not only makes my code look swollen, but also a hell lot more awkward... I mean, why would I even use MFC without being able to enjoy the sheer convenience that CString brings to us?
So since you guys are all experts I'm sure some of you will help. Below are part of my code:
<br />
class AFX_EXT_CLASS ClassFoo<br />
{<br />
public:<br />
void FuncBar(CString& str);<br />
};<br />
<br />
void ClassFoo::FuncBar(CString& str)<br />
{<br />
CString strOther = _T("blah blah blah");<br />
str = strOther;<br />
}<br />
<br />
void FuncFooBar()<br />
{<br />
ClassFoo foo;<br />
CString str;<br />
foo.FuncBar(str);
}<br />
I wish I explained my trouble clearly, and thanks in advance.
|
|
|
|
|
The problem you have described usually occurs when your main MFC exe and you extension DLL are both using different heap managers. Make sure you exe and MFC ext dll are using MFC in a shared DLL. You should hen be able to pass CString objects across without any problem.
As you currently have different heap managars, they are trying to deallocate pointers created by each other and having problems as they are not recognised.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
My dll and exe were using MFC in a shared dll, so I guess there must be something else are wrong...
|
|
|
|
|
1. Go to Project/Settings
2. Click in the C++ tab.
3. Select the Code Generation category.
4. Verify the "Use run-time library" combo has the same thing for both of your projects.
Here's what I use for my projects:
Win32 Debug: Debug Multithreaded DLL
Win32 Release: Multithreaded DLL
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
In the past I have had problems with..
=[ Abin ]= wrote:
AFX_EXT_CLASS
instead i use __declspec(dllexport) on the constructor/destructor and any functions I want to export.. Not sure if that has anything to do with your problem..
One other thing why "CString& str" in your dll function?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi,
I got a tricky deadlock, and I'm wondering if it's a good idea to process only individual messages.
What I would need to do is specifically pick and process WM_DEVICECHANGE messages from the message queue (without "killing" or processing other messages)
The PeekMessage documentation looks like it's possible (by providing a message range), but there's no discussion of it's implications. Any experience / documentation on that?
Problem at hand:
Communication with an USB device. When communication fails for any reason, the communication should try to recover and repeat the last transfer. This might involve a device reset, and reconnecting to the device.This should happen without knowledge of the caller.
To reconnect after a lost connection, I need to enumerate devices to find the device with the same serial. Windows sends WM_DEVICECHANGE messages to announce the device removal and reconnection.
Problem: Win 98 waits ca. 20 seconds for these messages to be processed before it gives up. This means that the new device (although plugged in) is not enumerated systemwide for 20 seconds (unless I process messages or cancel the process). Not acceptable (just to long).
The communication has no knowledge about the hosting application, and the hosting application can't easily process messages while transfers are pending (but it can't timeout for 20s)
Italian is a beautiful language. amare means to love, and amara bitter.
sighist | Agile Programming | doxygen
|
|
|
|
|
What framework do you use? (MFC, ATL, Win32 API?)
|
|
|
|
|
void DoEventsEx(UINT wMsgFilterMin, UINT wMsgFilterMax)
{
MSG msg;
while ( ::PeekMessage(&msg, NULL, wMsgFilterMin, wMsgFilterMax, PM_NOREMOVE ) )
{
if ( ::GetMessage(&msg, NULL, wMsgFilterMin, wMsgFilterMax))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else
{
break;
}
}
}
|
|
|
|
|
Hi,
I am building a wind synth that uses the API midi functions of
a soundcard. m_Note2 is an int value according to the keys pressed
and m_PBAD_2 is an int value ranging from 0-127 according to the airflow
thru the synth, updated according to the timer set at 250 millisec.
When I blow into the synth a note is played every 25sec but does not
stop, because the m_note in stopnote() outdated.
I have no idea what to add to the playnote() function. Any suggestions appreciated,
my knowledge of VC++ is very limited.
Cheers,
Rob
robert.harrington2@mail.dcu.ie
void CAD_mouthDlg::PlayNote()
{
UpdateData(TRUE);
MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,m_PBAD_2) ;
}
void CAD_mouthDlg::StopNote()
{
if(m_Key_Press == FALSE)
{
MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,0) ;
}
else
{
}
}
void CAD_mouthDlg::OnTimer(UINT nIDEvent)
{
CAD_mouthDlg::read_analog();
CAD_mouthDlg::SetPortChigh();
CAD_mouthDlg::OnButtonReadPort();
CAD_mouthDlg::PlayNote();
CAD_mouthDlg::StopNote();
CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
Hi
I am looking for the Automation of Ms Office Files (.doc, .xls, .ppt). So that the software shoudl be able to convert the documents into single or multiple page(s) HTML format. MS Word, MS Excel, MS Powerpoint, Visio and jpeg/gif format documents should be supported using VC6. The conversion of document should be able to take into account the layout scheme of the website and be able to embed the converted pages in the layout scheme of that particular website. How can i achieve this target? Can anyone help me out of this trouble?
I'll be realy grateful.
Thanx.
|
|
|
|
|
Ello
Anyone knows how i can easily disable a tab in a propertysheet without having to subclass the CPropertySheet?
i'm now using, when a condition is true, i just remove that page so you can't see it. That's already a good solution. The tab disabling looks even better tho
Greetings
Jens
|
|
|
|
|
Maybe you could use CPropertyPage::Create to create the page and set the style WM_DISABLED (2nd paameter).
~RaGE();
|
|
|
|
|
In my SDI application I have to write some text
in the View. I use TextOut function and it works fine
using a Default font size and type (I suppose).
I'd like to change font size and type. Is it
possible ?? How ??
Thanks a lot !!!
|
|
|
|
|
Could you use a CStatic for your Text? CP has plenty of information about CStatic.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
My View is not a CFormView derived class.
I'dont know if it is possible to create a CStatic control in
a CView derived class. But I'd prefer to don't use a a CStatic
control if it is possible...
Text I have to draw changes continously position in my View and
must be often created and destroyed so I think that it could be
more easy to use TextOut function...
But.. how to change font type and size ???
The only why is to create and manage CStatic controls ??
|
|
|
|
|
I have followed your message... and I have created
a CStatic control in my View.
It can be good !!! So I can use a derived class from
CStatic in order to change all parameters...
Now, I have another problem...
when my View is repainted the CStatic control is drawn
again (I suppose) and it blinks.
How can I solve this problem ??
Thanks a lot !!!
|
|
|
|
|
You have to draw it first in memory and, when it's done, you push it on the screen.
Use CreateCompatibleDC to create the memory dc compatible with the screen dc. Then draw your image on this device context, and, when it's done, send it to the screen dc using the BitBlt method (bitmap copy).
|
|
|
|
|
Use SelectObject() API function giving second parameter as HFONT
C.R.Naik
|
|
|
|
|
Hello
I'm trying to get the Ok/Cancel buttons to work with a modeless property sheet.
I've managed to get all buttons to show by overriding OnInitDialog() (I'm using the CTreePropSheet availible on this site)
BOOL CSettingsSheet::OnInitDialog()
{
m_psh.dwFlags &= ~PSH_HASHELP;
m_psh.dwFlags &= ~PSH_NOAPPLYNOW;
m_bModeless = FALSE;
BOOL bResult = CTreePropSheet::OnInitDialog();
m_bModeless = TRUE;
return bResult;
}
All buttons are shown despite of the dwFlags changes. How can I get rid of the apply/help buttons?
Thanks
|
|
|
|
|
In the Sheets constructor, before any of the pages are constructed, I call this:
m_psh.dwFlags |= PSH_NOAPPLYNOW;
m_psh.dwFlags &= ~PSH_HASHELP;
< edit > And here is what I do in the beginning of OnInitDialog
m_bModeless=FALSE;
m_nFlags |= WF_CONTINUEMODAL;
BOOL bResult = CPropertySheet::OnInitDialog();
m_bModeless= TRUE;
m_nFlags &= ~WF_CONTINUEMODAL;
< /edit >
Stop asking why - I just copied it from someone, and as it worked I never bothered to think about it again.;)
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I have dragged and dropped the progress bar control on a dialog and have also declared it's variable. Now I want to show increments in the progress bar in a loop. What would be the method of doing so.
Reply me soon
|
|
|
|
|
First you have to tell the low and high ranges with the SetRange( short nLower, short nUpper ) method. You can also specify a step increment with the SetStep( int nStep ) method.
For showing a new progress use the StepIt( ) method.
Take a look at the MSDN documentation. Everything is described there.
|
|
|
|
|
hey guys, good day.
i can view my database in visual c++ by ADO but one thing is that it not user-friendly. i have to click the navigating btn find the ID i want.
So i wanna have a search function like using titleid to search the thing i want. It like that, i key the no. 40 for titleid then click search. How should i start the code for search thanks.. alot
|
|
|
|
|
Hi,
I am facing problem with the richtext control. When you save the content with the bullet format, it works but when the same content is extracted from database format is totally lost instead certain unnecessary dot appears?
Help me out !
satan
|
|
|
|