|
I just wanted to close out this thread. I figured it out. The actual project file itself is built by the application wizard with some directives for compiling the appropriate help file(.chm for HTML help). So you definitely have to use the app wizard to create a new project file. You can continue to use the already developed files such as mainframe.[cpp and h]. But you have to copy in paste in a new project file and recreate the solution as well. Also, the output directory (debug/release) need to be completely cleaned in order to eliminate all previous winhelp files that were compiler generated. Other than that, the process is straightforward. Since I hadn't already implemented a lot of the help associated with winhelp there was not much code to change. Just add a call to EnableHtmlHelp() in your application object constructor. I also had to copy all of files from the app wizard generated hlp directory from the new temp project into the old one so that I had all of the default .htm and .hh* files in the directory for working with the HTML files.
Shawn
|
|
|
|
|
I still use VS 6.0, but I guess my considerations could help.
All you need is to redefine the CWinApp virtual function WinHelp . Then, define a CString member m_strHelpFilePath and put a full path to your .chm in it in CApp::InitInstance . (You can do something different, but the idea is to form and store the .chm path).
Your WinHelp function might look like this:
void CApp::WinHelp(DWORD dwData, UINT nCmd)
{
HWND hwndDesktop = ::GetDesktopWindow();
if (!HtmlHelp(hwndDesktop,
m_strHelpFilePath,
HH_HELP_CONTEXT,
nCmd == HELP_CONTEXT ? dwData : 0)))
{
HtmlHelp(hwndDesktop, m_strHelpFilePath, HH_HELP_FINDER, 0);
}
}
If you want your main frame to own the help window frame, pass m_pMainWnd->GetSafeHwnd() instead of hwndDesktop .
Hope this helps.
|
|
|
|
|
I am under developing graphic programing. I already completed main parts. But there is problem. I used gdi implementing graphics, and so there is aliasing. It looks all figures nasty. I searched all the articles here, but I could not find any articles about antialiasing. Is there any good argorithm to apply antialiasing to my graphics without using gdi+. I also used gdi+, but the performance is not good for my graphics. please help me. thanks in advance.
|
|
|
|
|
The link:
http://alglib.manual.ru/translate.php?location=/graphics/wuline&target=cpp[^]
It is a Russian resource, I guess you don't speak Russian. So, here you are:
#include "ap.h"
void drawwuline(double x1, double y1, double x2, double y2);
double myfrac(double x);
void drawwuline(double x1, double y1, double x2, double y2)
{
double grad;
double xd;
double yd;
double length;
double xm;
double ym;
double xgap;
double ygap;
double xend;
double yend;
double xf;
double yf;
double brightness1;
double brightness2;
int x;
int y;
int ix1;
int ix2;
int iy1;
int iy2;
bool wasexchange;
int tmpint;
double tmpreal;
xd = x2-x1;
yd = y2-y1;
if( xd==0&&yd==0 )
{
return;
}
if( fabs(xd)>fabs(yd) )
{
wasexchange = false;
}
else
{
wasexchange = true;
tmpreal = x1;
x1 = y1;
y1 = tmpreal;
tmpreal = x2;
x2 = y2;
y2 = tmpreal;
tmpreal = xd;
xd = yd;
yd = tmpreal;
}
if( x1>x2 )
{
tmpreal = x1;
x1 = x2;
x2 = tmpreal;
tmpreal = y1;
y1 = y2;
y2 = tmpreal;
xd = x2-x1;
yd = y2-y1;
}
grad = yd/xd;
xend = floor(x1+0.5);
yend = y1+grad*(xend-x1);
xgap = 1-myfrac(x1+0.5);
ix1 = floor(x1+0.5);
iy1 = floor(yend);
brightness1 = (1-myfrac(yend))*xgap;
brightness2 = myfrac(yend)*xgap;
if( wasexchange )
{
setpixel(iy1, ix1, brightness1);
setpixel(iy1+1, ix1, brightness2);
}
else
{
setpixel(ix1, iy1, brightness1);
setpixel(ix1, iy1+1, brightness2);
}
yf = yend+grad;
xend = floor(x2+0.5);
yend = y2+grad*(xend-x2);
xgap = 1-myfrac(x2-0.5);
ix2 = floor(x2+0.5);
iy2 = floor(yend);
brightness1 = (1-myfrac(yend))*xgap;
brightness2 = myfrac(yend)*xgap;
if( wasexchange )
{
setpixel(iy2, ix2, brightness1);
setpixel(iy2+1, ix2, brightness2);
}
else
{
setpixel(ix2, iy2, brightness1);
setpixel(ix2, iy2+1, brightness2);
}
for(x = ix1+1; x <= ix2-1; x++)
{
brightness1 = 1-myfrac(yf);
brightness2 = myfrac(yf);
if( wasexchange )
{
setpixel(floor(yf), x, brightness1);
setpixel(floor(yf)+1, x, brightness2);
}
else
{
setpixel(x, floor(yf), brightness1);
setpixel(x, floor(yf)+1, brightness2);
}
yf = yf+grad;
}
}
double myfrac(double x)
{
double result;
result = x-floor(x);
return result;
}
|
|
|
|
|
thanks a lot. I'll try...
|
|
|
|
|
I just create the text ocx( called testocx.ocx) to load some object.
and load into IE. here is the source for html.
when i click button button it will show message said "OK" but
when I new window (in IE File->New-> Window),
"Error, cannot get dispatch object" message will be shown.
We have the same problem for our company
core program. I put the OCX source(AddObj method) for refrence.
maybe someone can point what is problem.
OCX source*******************************
BOOL CTestocxCtrl::AddObj(LPDISPATCH inserObj)
{
CInsertObj * CCmdTarget pObj = ( CInsertObj *)CCmdTarget::FromIDispatch(
inserObj);
if (!pObj){
AfxMessageBox("Error, cannot get dispatch object");
}
else{
AfxMessageBox("OK");
}
return TRUE;
}
test.html*********************************
<title>
<object id="DTestocx1" style="WIDTH: 354px; HEIGHT: 269px"
classid="clsid:361B6B0E-B8D4-47FD-A373-2F37A801F3CD"><param name="_Version"
value="65536" /><param name="_ExtentX" value="7493" /><param name="_ExtentY"
value="5694" /><param name="_StockProps" value="0" />
|
|
|
|
|
I'm trying to statically link some libraries(Xerces) into my application with VS 2003 .Net. I'm trying to do this by adding the libraries to the "Additional Dependencies" field under the "Linker" section of the project properties. After rebuilding the application with these settings, the application still tries to link to the dynamic versions of the libraries.
Did I miss something?
Thanks
Hua-Ying
|
|
|
|
|
wrong library?
Don't try it, just do it!
|
|
|
|
|
Check the docs, some libraries (like id3lib) require you to #define a symbol differently when you use a static LIB build versus a DLL build.
Also make sure you're not picking up a #pragma comment(lib,"...") in a Xerces header file.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
Interesting, I'll check.
Thanks
Hua-Ying
|
|
|
|
|
After having had a look ad Xerces several month ago, too, I recommend to just drop Xerces and just use the much-easier-to-use MSXML3/MSXML4. Should be able to do all the things, Xerces does, too.
--
Affordable Windows-based CMS: www.zeta-producer.de/enu
|
|
|
|
|
Unfortunately I need a cross platform parser. I don't believe MSXML is cross platform.
|
|
|
|
|
Hi
I've now got a piece of code that updates an excel spreadsheet on my desktop. I was impressed - thanks to all the CP article writers that made this possible.
Anyway, I can see a bank of 10 users across from my desk who also want my code to update their spreadsheets - is this where DCOM comes in? I would install a DCOM component on all their clients and get my app to talk to the DCOM which in turn would update the local spreadsheet?
Any other 'simple' ideas would be much appreciated as I have no DCOM experience (or much COM come to think of it!!)
See if anybody can answer before David Crow!
Cheers
Angel
******************************************************
Why prolong the agony, all men must die - Roger Waters
|
|
|
|
|
Can your app be run locally on each machine?
Introducing DCOM would end up giving you more headaches than are good for you Especially if you don't know a lot about COM in the first place.
Have a read of some of these pages[^] to get a flavour of what DCOM is.
Michael
CP Blog [^]
|
|
|
|
|
I am trying to create an object of a class(say class1) in a member function of another class(say class2) on the heap. The trouble is it is asserting on that and i cannot proceed further. If I create a normal object(on stack) and call a member function of class1, the function is unable to access the member variables of its own class(class1). It's making me go nuts. I had earlier tested class1 for correctness but now that it is part of this whole application, I don't know what has happened. Please help me. It is urgent.
|
|
|
|
|
AmorphousP wrote:
The trouble is it is asserting on that...
On what? Show us some relevant code.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
CDns* DnsCl = new CDns;
This is the part where I am creating the object on the heap in a function of another class, CDnsThread. This is the code that asserts.
CDns* DnsCl;
This is the part when it is created on the stack. It doesn't assert but now when I call a public member fuction of the CDns class like
DnsCl->GetSMTPAddress(domain);
the code inside the GetSMTPAddress() function can't access it's own member variables. I tried debugging it and found that the constructor works fine because all the initialization work I do happens correctly. But the first line inside the GetSMTPAddress() function
if (SockStatus = INVALID_SOCKET)<br />
error handling code...
causes an 'access violation'. This same thing had worked very well some time back when I had tested this module. But now as a part of an application, it's causing troubles. I hope u r able to help.
Thanx
|
|
|
|
|
CDns* DnsCl = new CDns;
where does it assert ? check what you do in the constructor...
CDns* DnsCl;
this is not allocated at best, the pointer will be 0 , at worse, anything ... but DnsCl is invalid ... you need to new it; or remove the * .
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Tried removing the *. Didn't work either. Asserted on the Create call only.
|
|
|
|
|
AmorphousP wrote:
CDns* DnsCl = new CDns;
This is the part where I am creating the object on the heap in a function of another class, CDnsThread. This is the code that asserts.
What line of what file is firing the assertion? Have you set a breakpoint in the constructor of CDns and stepped through it?
AmorphousP wrote:
CDns* DnsCl;
This is the part when it is created on the stack. It doesn't assert but now when I call a public member fuction of the CDns class like
DnsCl->GetSMTPAddress(domain);
...
causes an 'access violation'.
I'm not surprised. How is this working without the new operator being called?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Actually the object is getting created dynamically now and I tried stepping through the constructor of CDns.
DnsSocket = new CSocket;<br />
SockStatus = TRUE;<br />
if (DnsSocket)<br />
{<br />
if (!DnsSocket->Create(0, SOCK_DGRAM, 0))
It's asserting on Create. It's here that it gives an access violation. The ASSERT that fires it is
ASSERT(CAsyncSocket::LookupHandle(hSocket, bDead) == NULL);
in the file sockcore.cpp
DavidCrow wrote:
AmorphousP wrote:
CDns* DnsCl;
This is the part when it is created on the stack. It doesn't assert but now when I call a public member fuction of the CDns class like
DnsCl->GetSMTPAddress(domain);
...
causes an 'access violation'.
I'm not surprised. How is this working without the new operator being called?
It was actually a desperate attempt to get the work done although wasn't a very logical choice.
|
|
|
|
|
AmorphousP wrote:
DnsSocket = new CSocket;
What do u do before this line ? You must be calling Create() before the socket object is initialized.
Dharani Babu S
|
|
|
|
|
I actually solved the problem. The trouble was that this code (DnsSocket = new CSocket ) is written inside a new secondary thread. As such there was no initialization code for winsock in the thread and that's why the code was asserting on DnsSocket->Create() . Now it works fine
-----------------------------
Nobody got anywhere in this world by simply being content.
|
|
|
|
|
Hi!
I recently stumbled over this interesting phenomenon using abstract member functions:
The situation is this: We have an abstract base class that defines an interface. In the constructor of the base, a specific implementation dependent task needs to be carried out, so an abstract
member function is invoked in the constructor. The behaviour of this member function is defined by derived classes.
If no function body is provided for this abstract function in the base class, a linker error occurs (unresolved symbol). If we provide an empty body, in the base, everything links fine and the vtable
lookup correctly resolves the implementation of the deriving class.
The question is this: If the abstract function is resolved at run-time anyway, through use of vtables, why give me a compile-time error if I don't provide a body that will, due to it being an abstract
function, never be used in the first place?!
Is this a Microsoft specific behaviour bug/"feature", or is this standard ISO behaviour?
I compiled this using MS VS .NET 2003
Thanks for any thoughts about this.
Nick
Here is some exaple code for you to check it out:
<br />
#include <stdio.h><br />
class base<br />
{<br />
public:<br />
base()<br />
{<br />
abstractFunction();<br />
}<br />
virtual ~base() {};<br />
<br />
<br />
virtual void abstractFunction() = 0 ;<br />
};<br />
<br />
class derived : public base<br />
{<br />
public:<br />
derived() {};<br />
virtual ~derived() {};<br />
<br />
void abstractFunction()<br />
{<br />
printf("works\n");<br />
}<br />
} testInstance;
This code should print "works" to the console, since the
As soon as you uncomment the function body of base::abstractFunction(), everything will link fine and work as expected.
|
|
|
|
|
You cannot call a virtual function of a derived class from a base class constructor. This is due to the order of construction. Base classes are built first so there is no vtable pointer available to call the correct function in the derived class, which is yet to be constructed.
You need the function body as the virtual call compiles to the base class member function not the derived class one.
You need a two stage construction method to handle what you need to do.
x = new drieved;
x.Initialise();
Where the initialise function calls the correct virtual functions once the object is fully constructed.
If you vote me down, my score will only get lower
|
|
|
|