|
Interesting. Consider CreateProcess().
Kuphryn
|
|
|
|
|
tinkywinky wrote:
in my progr I use ShellExecute to open an internet link, and each time I call ShellExecute the page is opened in the same IE window.. how to open a new window ?
That's actually an options in IE where people can select if pages should recycle windows or open in a new one...
Tools->Internet Options->Advanced
Under browsing there's a checkbox called "Reuse Windows for Launching Shortcuts". If you wanna force it try createprocess as already sugested...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Use the opennew verb instead of open.
|
|
|
|
|
COol, thanks
|
|
|
|
|
Hi!
I have a dialog and I create button [myButton->Create(...)].
1. When I use OnLButtonDown in my dialog, it doesn't react when myButton is clicked. I want to know when my dynamic button is clicked.
2. How to recive messages from this dynamic button?
|
|
|
|
|
>I have a dialog and I create button [myButton->Create(...)].
>1. When I use OnLButtonDown in my dialog, it doesn't react when myButton
>is clicked. I want to know when my dynamic button is clicked.
Why should it, after all you clicked on button, not the dialog.
>How to recive messages from this dynamic button?
There are number of ways you can get notified when user clicked on child control....
When you creating myButton you are passing handle for the parent CMyDialog....
1) Add public member CMyDialog::ButtonPressed(CString& strName), override inside CmyButtonClass::OnLButtonDown to do something like
{
CMyDialog *pDlg = (CMyDialog *) GetParent();
pDlg->ButtonPressed(CString("myButton");
}
2) You can define own custom message and send it to parent...
3)....
Brian
In CmyButton::OnLButtonDown() you could GetParent()
|
|
|
|
|
Override OnNotify and check for BN_CLICKED notification from your button's ID.
Regards,
BB
|
|
|
|
|
Friends,
I want to subclass an edit control present on my dialog template. For this purpose i derived my on class CMyDialog form base CEdit, and assign the instance of edit control to my class instead of CEdit class. Every thing works fine till here and program runs successfully. Then i needed to handle the WM_PAINT message of my edit control, so i override OnPaint in CMyDialog class. Till here everything works fine.
Now the problem is that i want to handle WM_CREATE message of edit control also. For this purpose i am overriding OnCreate(), but the trouble is that the program is not calling my overridden OnCreate method. Any idea ???
|
|
|
|
|
WM_CREATE is sent to the edit control befeore you get a chance to subclass it, so you have to override PreSubclassWindow() instead.
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!
|
|
|
|
|
I have many errors when I compiled it. I think it's all from overloading operator. I have so many errors...this is one of them
binary '+' : no operator defined which takes a right-hand operand of type 'class FuelPurchase' (or there is no acceptable conversion. Can anyone fix please this for me?
Here's my coding
Header file of vehicle
<br />
#ifndef VEHICLE_H<br />
#define VEHICLE_H<br />
using namespace std;<br />
<br />
static const int LEN = 25;<br />
<br />
class Vehicle<br />
{ <br />
private:<br />
char name[LEN]; <br />
char model[LEN]; <br />
int year;<br />
int totalcost;<br />
int totallitres; <br />
<br />
public:<br />
Vehicle();<br />
Vehicle(const char *n, char *m, int y);<br />
Vehicle(const Vehicle &r);
Vehicle operator +(const Journey& m) const;<br />
Vehicle operator +(const FuelPurchase& f) const; <br />
print(); <br />
<br />
<br />
};<br />
#endif<br />
source file of Vehicle
<br />
#include <iostream.h><br />
#include <iomanip.h><br />
#include <string.h><br />
#include "vehicle.h"<br />
<br />
using namespace std;<br />
<br />
Vehicle::Vehicle()<br />
{<br />
strcpy(name, "");<br />
strcpy(model, "");<br />
year = 0;<br />
}<br />
<br />
Vehicle::Vehicle(char *n, char *m, int y) <br />
{<br />
strncpy(name, n, LEN);<br />
strncpy(model, m, LEN);<br />
year = y;<br />
}<br />
<br />
Vehicle::Vehicle(const Vehicle &r)
{<br />
name = r.name;<br />
model = r.model;<br />
year = r.year;<br />
totalcost = r.totalcost;<br />
totallitres = r.totallitres;<br />
<br />
}<br />
<br />
Vehicle:perator +(const Journey& m);
{<br />
Vehicle v;<br />
v.totaldistance = totaldistance + m.distance;<br />
return (*this);<br />
<br />
} <br />
<br />
Vehicle:perator +(const FuelPurchase& f);
{ <br />
Vehicle v;<br />
v.totalcost = totalcost + f.cost; <br />
v.totallitres = totallitres + f.litres; <br />
return (*this);<br />
<br />
}<br />
<br />
<br />
Vehicle:Print() <br />
{ int distance=0,services=0,cost=0,litres=0;
double fueleconomy=0, average=0;
cout.setf(ios::fixed);<br />
cout.setf(ios::showpoint);<br />
cout.precision(1);<br />
<br />
cout <<"Vehicle: "<<endl;
cout <<distance<<"km travelled requiring "<<litres<<" litres of fuel at a cost of$"<<cost<<endl;
if (distance==0)<br />
{ <br />
cout <<"No travel has been recorded yet"<<endl;<br />
cout <<"No fuel has been purchased yet"<<endl;<br />
}<br />
<br />
else<br />
{ <br />
int fueleconomy = (litres/distance)*100;
cout << "This vehicle achieved a fuel economy of "<<fueleconomy<<"litres/100km"<<endl;<br />
int services = distance/100;<br />
cout << "This vehicle should have undergone "<<services<<" service(s)"<<endl;
average = cost/litres;<br />
cout << "The average cost of fuel was $ "<<average<<endl;<br />
}<br />
return(0);<br />
}<br />
this si header file for journey
<br />
#ifndef JOURNEY_H<br />
#define JOURNEY_H<br />
<br />
class Journey<br />
{<br />
private:<br />
int distance;<br />
<br />
public:<br />
Journey();<br />
Journey(const int distance);<br />
<br />
};<br />
#endif<br />
this is source file file journey
<br />
#include <iostream><br />
#include "journey.h"<br />
using namespace std;<br />
<br />
Journey::Journey()<br />
{<br />
distance = 0;<br />
}<br />
<br />
Journey::Journey(int distance)<br />
{<br />
distance = d;<br />
}<br />
here's the header file for FuelPurchase
<br />
#ifndef FUELPURCHASE_H<br />
#define FUELPURCHASE_H<br />
<br />
class FuelPurchase<br />
{<br />
private:<br />
int cost;<br />
int litres;<br />
<br />
public:<br />
FuelPurchase();<br />
FuelPurchase(const int c, int l);<br />
<br />
};<br />
#endif<br />
This is source file for FuelPurchase
<br />
#include <iostream.h><br />
#include "fuelpurchase.h"<br />
using namespace std;<br />
<br />
FuelPurchase::FuelPurchase()<br />
{<br />
cost = 0;<br />
litres = 0;<br />
<br />
}<br />
<br />
FuelPurchase::FuelPurchase(int c, int l)<br />
{<br />
<br />
cost = c;<br />
litres = l;<br />
}<br />
Here's the main code...
<br />
#include <iostream><br />
#include <string><br />
<br />
using namespace std;<br />
<br />
#include "Vehicle.h"<br />
#include "FuelPurchase.h"<br />
#include "Journey.h"<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
Vehicle a("BMW", "A6", 2003);<br />
Vehicle b("Toyota", "A100", 2003);<br />
Vehicle c("Mercedes-Benz", "CL600", 2003);<br />
<br />
cout << "Original Statistical:" << endl;<br />
cout << "=====================" << endl;<br />
<br />
a.print();<br />
b.print();<br />
c.print();<br />
<br />
a = a + FuelPurchase(50, 60);<br />
a = a + Journey(150);<br />
a = a + FuelPurchase(12, 15);<br />
<br />
b = b + FuelPurchase(50, 60);<br />
b = b + Journey(250);<br />
b = b + FuelPurchase(22, 22);<br />
<br />
c = c + FuelPurchase(50, 60);<br />
c = c + Journey(350);<br />
c = c + FuelPurchase(50, 40);<br />
<br />
cout << "Final Statistics:" << endl;<br />
cout << "=================" << endl;<br />
<br />
a.print();<br />
b.print();<br />
c.print();<br />
<br />
return(0);<br />
}<br />
|
|
|
|
|
Tozilla wrote:
I have many errors when I compiled it.
You're right, you have many errors. Among them are many typos, mismatched parameters, undeclared variables, misplaced semicolons, etc.
Trying to overload the '+' operator is the least of your problems.
Please cleanup all the other simple errors first, and then repost your code, and then maybe someone can help you with the operator override part.
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!
|
|
|
|
|
ok...i fixed some of the errors. but i still ahve the same errors
|
|
|
|
|
I want to draw a picture without overlay any button .how to set?
|
|
|
|
|
You would load bitmap into CBitmap.LoadBitmap()
and inside method OnPaint()
1)Create new temporary DC... CreateCompartibleDC();
2)Select bitmap into it, saving original. pOldBitmap = tempDC.SelectObject(&bitmap)
3)BitBlt bitmap from created tempdc into your control window dc;
4)restore orginal: tempDC.SelectObject(pOldBitmap);
Brian
|
|
|
|
|
thank Brian,but overlay my button when i redraw the picture.i want not overlay my overlay my button when i redraw.how to do?
|
|
|
|
|
i'm pretty good in c++ and i was wondering where the BEST place to learn winsock is? thanks
|
|
|
|
|
Books.
I highly recommend Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.
Kuphryn
|
|
|
|
|
kuphryn wrote:
I highly recommend Network Programming for Microsoft Windows, Second Edition
I can also say a word about that book. I give that book 5/5 points! It's VERY easy to understand you don't need any knowledge about Winsock to understand it!
It's a perfect book! I just love it!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
|
How do I change the ip address of my computer?? I want to be also to change it back when finished testing. I am writing a window sockets program and want to change the ip address from the dos prompt..
Thanks,
grahamoj.
|
|
|
|
|
i think you can do it with "ipconfig" from DOS
|
|
|
|
|
I want to add my own tab group to the output window and redirect messages from the debug output window to it. The second part i know how to do but just cannot find any info on the first, does anyone know to do this and if its even possible?
I've looked through all the cool addin articles on here and using Nick Hoddap ShowInnards() found out its called COutputWindow, but that is as far as i can figure. He also mentions that they use their own custom tab window class so iterating the windows until i find doesn't seem like it will help as i have no idea of the interface to use when i get there.
Nothing in msdn or on microsoft mentions anything about it. VC.Net makes it a piece of cake but we're still gonna be using v6 for at least another year;(
Thanks for any help
Martin Slater
|
|
|
|
|
Correct::
ON_Point www;
const ON_3dPoint jjj = www.point;
Got ERROR:: error C2228: left of '.point' must have class/struct/union type
const ON_Point* actPoint;
const ON_3dPoint* kkk = actPoint.point;
What does the Error mean?
Thanks
|
|
|
|
|
const ON_Point* actPoint;
const ON_3dPoint* kkk = actPoint.point;
What are you doing?
actPoint is a pointer to nowhere.
If ON_Point::point is supposted to be a pointer to type ON_3dPoint the where was it allocated. If point is a pointer and was initialize/allocate in the constuctor for ON_Point (which I would find a questionable practice) then the solution is simple.
const ON_Point* actPoint = new ON_Point;
const ON_3dPoint* kkk = actPoint.point;
But I need to tell you this little code snippet scares me, I see nightmare in your future.
Trust in the code Luke. Yea right!
|
|
|
|
|
I create a simple CListBox from the resource designer and I set the horizontal scroll property but then I add some long strings in the control, all the text are truncated and the horizontal scroll bar is not displayed.... I can't figure out what the problem could be...
Any idea?
|
|
|
|