|
|
Hello,
I am a beginner trying to understand how to use an API (in this case HtmlHelp). I am not sure how to call an API method: I want to call a method HtmlHelp(...), which has four arguments, and I can see this in Intellisense if I put two colons before the methodname:
::HtmlHelp(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD dwData) ;
However, all the examples I read show the method being called without the two colons, yet with four arguments. What does this mean?? Does this relate to namespaces?? When I take away the colons, the Intellisense shows only the CWinApp method:
virtual void HtmlHelp(DWORD_PTR dwData, UINT nCmd = 0x000F);
with two arguments. When I use the ::HtmlHelp(...) with four arguments, I get the following error message:
LPSEmail error LNK2019: unresolved external symbol _HtmlHelpA@16 referenced in function "public: int __thiscall CMainFrame::OnHelpInfo(struct tagHELPINFO *)" (?OnHelpInfo@CMainFrame@@QAEHPAUtagHELPINFO@@@Z)
I have placed the htmlhelp.lib file in the lib directory, and the htmlhelp.h at the top of this class. So what have I done wrong?? Do I need the colons??
Sincerely,
Trimtrom
|
|
|
|
|
The double colons force the compiler to look in the global namespace for the function - without them it will always look in the current class first, meaning that it finds the HtmlHelp() method rather than the global function.
To link with HtmlHelp.lib, you must add it to the list of libraries in the project settings (Project->Settings->Link) - it does not automatically link with all libraries in the lib directory.
Dave
|
|
|
|
|
I'm creating an SDI application using the CListView class as the base view, and I'm having a problem knowing when I should do things like InsertColumn(). If I use the OnInitialUpdate() method, columns get inserted every time that a new document gets created. When I try to use the OnCreate() method, I get an exception stating that the main frame has not yet been created (note that I'm getting a pointer to the main frame object to set some window "snap" settings).
Is there a method for a view that gets called only once upon program startup, but after all the windows have finished their creation state? I basically want to know where I should insert columns and do other, one-time initialization stuff.
Any ideas?
Thanks,
Jonah Bishop
Visit JGB Productions
|
|
|
|
|
How about just using a flag bListCtrlInitialized in OnInitialUpdate() to ensure it gets done just once?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Yes - I've thought of that, and it certainly would work. But it just seems so cheap...
Jonah Bishop
Visit JGB Productions
|
|
|
|
|
I am trying to create a color palette that will allow someone to pick what color of text they want. I can't seem to find anything to help me out on this. Any ideas?
|
|
|
|
|
Use the ChooseColor function to create a dialog box where you can pick a color.
|
|
|
|
|
I have a string that is :
string myString ="Appliance.Oven.Heater";<br />
string commandString="Run:appladdr:TurnOn:150seconds"; In commandString I want to replace "appladdr" with myString .
for the final string to be
Run:Appliance.Oven.Heater:TurnOn:150seconds
I was getting a memory error using CString .
when I did
CString finalString = commandString.c_str();<br />
finalString.replace("appladdr",myString.c_str());
What am i doing wrong ?
I would like to do this using STL itself.
|
|
|
|
|
act_x wrote:
What am i doing wrong ?
I would like to do this using STL itself.
My good deed of the day:
#include <iostream.h>
#include <string>
using namespace std;
void main()
{
string myString ="Appliance.Oven.Heater";
string commandString="Run:appladdr:TurnOn:150seconds";
commandString.insert(4, myString.c_str());
commandString.replace(24, 8, "");
cout << commandString.c_str() << endl;
}
-Nick Parker
The true measure of a man is how he treats someone who can do him absolutely no good. - Samuel Johnson
|
|
|
|
|
Using STL:
int nPos = commandString.find( "appladdr" );
if ( nPos != string::npos ) {
commandString.replace( nPos, strlen("appladdr"), myString );
}
The MFC code looks right though - what exactly is the memory error that you are getting, and on which line?
Dave
|
|
|
|
|
I am doing all of the MFC in thread functions . I do not know if that is a problem . I am getting memory read errors .
|
|
|
|
|
Are you sharing the string objects between threads? MFC objects should never be used in more than one thread, and the default STL string implementation provided with VC6 is not threadsafe for reading.
Dave
|
|
|
|
|
Hello CPIAN_GURUS!
I've placed a WebBrowser2 control (the active x that comes with VC++6 (Project >> Add To Project >> Components & Controls >>...)) In a dialog and in an array of property pages...
The one that is in the dialog works perfectly, but the one that is in the array of property pages don't appear... the strange thing is that I hear the sound of the page loaded (the 'click' that sounds when a page has been loaded completely) but I cannot see the control...
Any idea?
Do you think I'm missing something?
TYIA!!!
|
|
|
|
|
Perhaps the one on the property page is incorrectly positioned/sized?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have varying widthg content that will populate the CCombobox. I checked autoHSCrollin rthe design view but it doesnt develop the horiz scrollbars when necessary> How can I get the horiz scroll functionality?
Appreciate your help,
ns
|
|
|
|
|
I don't know, but this[^] article shows to craft a combobox whose droplist is always wide enough to display the widest string in the combobox.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
sounds promising...
Appreciate your help,
ns
|
|
|
|
|
CComboBox::SetHorizontalExtent()
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi everybody!
Can anyone tell me how to use CDaoRecordset::Delete();
to delete records in a *mdb database.
Thanks!..
|
|
|
|
|
How do you put controls into a non-doc/view MDI child window?
-- Steve
|
|
|
|
|
Either create a dialog, and put the controls via the resource editor, and create the dialog as a modeless dialog in the child window , or create each individual controls manually in the child window.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
I'm not expirianced in using MFC, so I need help in working with CStringList class
I'm not eble to set or get elements of this collection.
I need an example.
Thank you
|
|
|
|
|
Here's an example. Btw, see if CStringArray (a directly accessible dynamic array of CStrings ) is more suited to your needs. I tend to use that because it's more efficient. Of course if you need a list, then CStringList is the non-STL way to go.
CStringList myStringList;
CString strFirst = "First";
CString strSecond = "Second";
CString strThird = "Third";
POSITION pos = myStringList.GetHeadPosition();
pos = myStringList.InsertAfter (pos, &strFirst);
pos = myStringList.InsertAfter (pos, &strSecond);
pos = myStringList.InsertAfter (pos, &strThird);
pos = myStringList.GetHeadPosition();
while (pos != NULL) {
CString* pString = (CString *) myStringList.GetNext (pos);
TRACE ("Element = %s\n", *pString);
}
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
do the job that UrlDecod() in asp by vc6.
vc newbie , thx for your help !
|
|
|
|