|
Have you tried asking here?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All
How can write data in excel and pdf fle?Plz help me
|
|
|
|
|
|
All,
When I install my Win32 Service using CreateService() I am utilizing a TCHAR string (szPath) to input the full path to the service executable. However, when the service is installed instead of inputting this path to the executable it is inputting the path to the service installation executable that this code resides in.
Can someone explain to me why this would be happening?
Thanks
TCHAR szPath[MAX_PATH] = (L"\"C:\\Program Files\\Temp.exe\"");
TCHAR szStartName[50] = (L"Domain\\User");
TCHAR szStartNamePassword[50] = (L"**********");
schService = CreateService(
schSCManager,
SVCNAME,
SVCNAME,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL,
szPath,
NULL,
NULL,
NULL,
szStartName,
szStartNamePassword);
|
|
|
|
|
Please help me use this to create a function that will find the minimum spanning tree. I am unsure of how to use the findEdge function to find edges that I can measure their weights for to find the minimum tree. Please help. Hi this is the code for a graph from my book:
#ifndef EDGE_H
#define EDGE_H
class Edge
{
public:
int v, w, weight;
Edge(int firstVertex, int secondVertex, int edgeWeight)
{
v = firstVertex;
w = secondVertex;
weight = edgeWeight;
}
};
#endif
#ifndef GRAPH_H
#define GRAPH_H
#include <vector>
#include <list>
#include <map>
#include "Edge.h"
using namespace std;
class Graph
{
public:
int numVertices;
int numEdges;
vector<map<int, int> > adjList;
Graph(int n);
int getNumVertices() const;
int getNumEdges() const;
int getWeight(Edge e) const;
void add(Edge e);
void remove(Edge e);
map<int, int>::iterator findEdge(int v, int w);
};
#endif
#include "Graph.h"
Graph::Graph(int n)
{
map<int, int>element;
adjList.assign(n, element);
numVertices = n;
}
int Graph::getNumVertices() const
{
return numVertices;
}
int Graph::getNumEdges() const
{
return numEdges;
}
int Graph::getWeight(Edge e) const
{
return e.weight;
}
void Graph::add(Edge e)
{
int v = e.v,
w = e.w,
weight = e.weight;
adjList[v].insert(make_pair(w, weight));
adjList[w].insert(make_pair(v, weight));
numEdges++;
}
void Graph::remove(Edge e)
{
int v = e.v,
w = e.w,
weight = e.weight;
adjList[e.v].erase(w);
adjList[e.w].erase(v);
numEdges--;
}
map<int, int>::iterator Graph::findEdge(int v, int w)
{
map<int, int> m = adjList[v];
map<int, int>::iterator iter = m.find(w);
return iter;
}
|
|
|
|
|
the algorithm and code is explained in many papers. Just google it.
the next thing is that, if this is not your homework, you can use
Boost Graph Library. It supports both Kruskal and Prim's algorithms.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
#include<iostream.h>
#include<string.h>
enum Status{outoforder,ok};
//enum bool{false,true};
template <class T>
class List{
public :
List () { }
List (int s){
maxSize=s;
used=0;
a= new T [maxSize];
}
//~List () { delete []a;}
bool addObjects(T p){
if (!isFull()){
a[used]=p;
used ++;
return true;
}
else
return false;
}
int getMaxSize() { return maxSize;}
int getUsed() { return used;}
bool setObject (int index,T p )
{ if ((index <used )&&(index>=0)){
a[index]=p;
return true;
}
else
return false;
}
bool getObject (int index,T &p )
{ if (!isEmpty()) {
if ((index <used )&&(index>=0)){
p=a[index];
return true;
}
else
return false;
}
else
return false;
}
int isFull() { return used==maxSize;}
int isEmpty () { return used==0;}
private :
T *a;
int maxSize;
int used;
};
class HardDisk{
public:
HardDisk(){}
HardDisk(int c){cap=c;}
void setHd(int c){cap=c;}
int getHd(){return cap;}
private:
int cap;
};
class Processor{
public:
Processor(){}
Processor(float c){Cs=c;}
void SetPro(float c){Cs=c;}
float getPro(){return Cs;}
private:
float Cs;
};
class Ram{
public:
Ram(){}
Ram(int c){Cap=c;}
void setRam(int c){Cap=c;}
int getRam(){return Cap;}
private:
int Cap;
};
class Monitor{
public:
Monitor(){}
Monitor(char *t){strcpy(Type,t);}
void setM(char *t){strcpy(Type,t);}
char* getM(){return Type;}
private:
char Type[15];
};
class Keyboard{
public:
Keyboard(){}
Keyboard(char *t){strcpy(Type,t);}
void setK(char *t){strcpy(Type,t);}
char* getK(){return Type;}
private:
char Type[15];
};
class Mouse{
public:
Mouse(){}
Mouse(char *t){strcpy(Type,t);}
void setMo(char *t){strcpy(Type,t);}
char* getMo(){return Type;}
private:
char Type[15];
};
class CdRom{
public:
CdRom(){}
CdRom(char *t){strcpy(Type,t);}
void setCd(char *t){strcpy(Type,t);}
char* getCd(){return Type;}
private:
char Type[15];
};
class Speaker{
public:
Speaker(){}
Speaker(char* s){Size=s;}
void setSpeaker(char* s){Size=s;}
char* getSpeaker(){return Size;}
private:
char* Size;
};
class Computer{
public:
Computer(){}
Computer(Status s, int h,float pr,int rm,char* m,char *kb,char *mon):hd(h),p(pr),r(rm),m(mon),mo(m),k(kb){
status=s;}// cd=NULL;s=NULL;}
void setStatus(Status s){status=s;}
Status getStatus(){return status;}
void setHardDisk(int h){hd.setHd(h);}
int getHardDisk(){return hd.getHd();}
void setProcessor(float pr){p.SetPro(pr);}
float getProcessor(){return p.getPro();}
void setRam(int ra){r.setRam(ra);}
int getRam(){r.getRam();}
void setMonitor(char *mo){m.setM(mo);}
char *getMonitor(){return m.getM();}
void setKeyboard(char *ke){k.setK(ke);}
char *getKeyboard(){return k.getK();}
void setMouse(char *m){mo.setMo(m);}
char *getMouse(){return mo.getMo();}
void setCd(char *c){
if(cd!=NULL)
cd->setCd(c);
}
char * getCd(){
if(cd!=NULL)
return cd->getCd();
else
return NULL;
}
void setSpeaker(char *c){
if(s!=NULL)
s->setSpeaker(c);
}
char * getSpeaker(){
if(s!=NULL)
return s->getSpeaker();
else
return NULL;
}
int addSpeaker(char *t){
if(s==NULL){
s=new Speaker(t);
return 1;
}
else
return 0;
}
int removeSpeaker(){
if(s!=NULL){
delete s;
return 1;
}
else
return 0;
}
int addCd(char *t){
if(cd==NULL){
cd=new CdRom(t);
return 1;
}
else
return 0;
}
int removeCd(){
if(cd!=NULL){
delete cd;
return 1;
}
else
return 0;
}
/* void print(){
cout<<"\n.....................................\n";
cout<<"Status = "<<status<<endl;
cout<<"Hard Disk = "<<getHardDisk()<<endl;
cout<<"Processor = "<<getProcessor()<<endl;
cout<<"Ram = "<<getRam()<<endl;
cout<<"KeyBoard = "<<getKeyboard()<<endl;
cout<<"Monitor = "<<getMonitor()<<endl;
cout<<"Mouse = "<<getMouse()<<endl;
if(cd!=NULL){
{ cout<<"CDROM = "<<getCd()<<endl;}
else
cout<<"No CD Rom "<<endl;
if(s!=NULL){
cout<<"Speaker = "<<getSpeaker()<<endl;
else
cout<<"No Speaker "<<endl;
}
} */
private:
Status status;
HardDisk hd;
Processor p;
Ram r;
Monitor m;
Keyboard k;
Mouse mo;
CdRom *cd;
Speaker *s;
};
class Lab{
public:
Lab(int no , int size):ls(size){
labno=no;
}
int addComputer(Computer p){return ls.addObjects(p);}
void printComputer(){
Computer t;
for(int i=0;i<ls.getUsed();i++){
ls.getObject(i,t);
//t,print();
}
}
private:
int labno;
List <Computer> ls;
};
void main(){
Lab l1(1,10),l2(2,10),l3(3,10);
Computer ob (ok,80,2000,1,"Ball","Standard","14 in Flat ");
//ob.print();
l1.addComputer(ob);
}
|
|
|
|
|
I wouldn't expect much help with a question like that.
Why not tell us what kinds of problems you are having with this code?
That'd be a good start.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
iam facing these errors when i run the code can u plz help me fix them
1. functions containing for are not expanded inline.
2. functions containing missing return statements are not expanded.
3. tye name expected.
4. declaration missing ;
5. undefinid symbol 'a'
6. 'addobjects' is not a member of 'list <computer>'.
|
|
|
|
|
I tried your code on a visual studio 2005 compiler and it is compiling fine.
-Suhredayan
|
|
|
|
|
It's one thing asking for help - it's another thing expecting us to do your job for you.
You don't read the posting guidelines, so your quoted code is just a slab of text I have no intention of reading.
You don't give any actual errors.
In a reply to another reply, you give some example errors - which sound like things you can fix yourself.
"If a function is missing return..." Then [bleep]ing fix the code so it isn't missing a return!
"...doesn't expand inline". 1/ so what? the compiler is free to make judgements. inline is only a recommendation. 2/ How do you even know it doesn't? 3/ From memory, inline expansion is not done in debug mode.
Also, even if you get the code to compile, that's no reason to say it "wrkz". We don;t know your requirements, so we can't fix all errors.
I wish you luck with your debugging,
Iain.
|
|
|
|
|
Hi all,
I'm a beginner and have a beginner question. I want to create a WinForm in C++. I created a Win32 Console Application in VS2008 and write these codes to create a WinForm (They're exactly what I saw in my ebook):
#include "stdafx.h"
#include "windows.h"
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, INT)
{
WNDCLASSEX wc = {sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
TEXT("TEST"), NULL};
RegisterClassEx(&wc);
HWND hWnd = CreateWindow(TEXT("TEST"), TEXT("TEST"),
WS_OVERLAPPEDWINDOW, 100, 100, 512, 512,
GetDesktopWindow(), NULL, wc.hInstance, NULL);
}
What is MsgProc ? I have error on this line. error C2065: 'MsgProc' : undeclared identifier.
Thank you in advance.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
That code has nothing to do with "WinForms" - whatever "WinForms" are (?).
That's basic window creation, and it's pretty much the fundamental concept
in Windows programming.
I would strongly suggest studying at least the windowing overviews here:
Windowing[^]
especially the sections Windows, Window Classes, Window Procedures, and Messages.
The Window Procedures section will explain what the MsgProc parameter is.
It's not difficult to understand, but it is essential knowledge for effective
Windows programming
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks a lot Mark. Reading your link
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Seems you've started learning SDK style win32 programming. Well, I recommend you to read "Talk to me like I'm a 3 year old!" programming series by GameTutorials at first. Check it here[^].
Once you finished reading it, you'll find out the answer for your problem, yourself!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks Jijo. I'm reading your link. I wonder what are those question marks (�) for? (Maybe I don't know the page Encoding!)
Jijo raj wrote: "Talk to me like I'm a 3 year old!"
Actually "A 3 hour old!"
However thank you.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Pedram Behroozi wrote: Thanks Jijo. I'm reading your link. I wonder what are those question marks (�) for? (Maybe I don't know the page Encoding!)
Me too had the same problem. It could be character encoding problem as you said.
Pedram Behroozi wrote: Actually "A 3 hour old!" Laugh
New Born SDK Baby!
Well, wish you all the best.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Pedram Behroozi wrote: I wonder what are those question marks (�) for? (Maybe I don't know the page Encoding!)
Looks like a firefox issue. Worked well on IE6.
|
|
|
|
|
You're right. Obvious!
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Hi,
I have a multiline CEdit control with some text. I want to find a word in this Edit control.
But I am not able to find the ans of following question.
1. How to get some string or part of string in between the CEdit control.?
2. Then if string matched how to make that word highlight?
|
|
|
|
|
I'm a bit rusty on this, but here goes
1) assign a member variable of type CString to the Edit Control. eg m_MyEdit .. you can then go CString someText = m_MyEdit .. you'd then need to parse this string in someText to find your word - maybe parse by spaces and or keywords
2) dont think you can do this 'simply' - I know you can change the font color and or background for the whole control, but not for a single words as part of a string - you may need an owner draw control using a 'light' rtf syntax or even better do it using a html type display - there are examples of each here on CP
'g'
|
|
|
|
|
MPTP wrote: 2. Then if string matched how to make that word highlight?
Doesn't SetSel [^] fit your needs, does it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
good thinking - I was thinking in a different context ...
btw, how was your Holiday ? (I expect to be in Europe, especially Lago di Como, next year, from 18th Sept to 4th Nov)
'g'
|
|
|
|
|
Garth J Lancaster wrote: btw, how was your Holiday ?
Good, thank you.
Garth J Lancaster wrote: (I expect to be in Europe, especially Lago di Como, next year, from 18th Sept to 4th Nov)
No visit to Roma? Uhmmmmmmmmmmm
BTW welcome to the THHB [^] [^], Garth!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: BTW welcome to the THHB
chuckle - not sure wether to laugh or cry - since there's a smiley face in your post I'll stick with laugh
CPallini wrote: No visit to Roma? Uhmmmmmmmmmmm
not this time unfortunately, I realise that must almost be a sin - I was there a few years ago - spent 5 glorious weeks in Italy, but I have limited time next trip so I want to visit somewhere I missed first time round
If I had an unending supply of $$ I'd live in Europe 6 months of the year, but I'll never see all the places I want to
ciao !!
|
|
|
|
|