|
Use an array of arrays...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Or you could derive a custom class from CObject of whatever you want to put in there. For instance, I have this class in my current project:
class CBitmapObject : public CObject {<br />
public:<br />
CBitmapObject (BYTE newColor, int newCount) { <br />
color = newColor;<br />
count = newCount;<br />
}<br />
~CBitmapObject(void);<br />
BYTE getColor () { return color; }<br />
int getCount () { return count; }<br />
private:<br />
BYTE color;<br />
int count;<br />
};
then I have a CObList named m_bitmapDataArray that adds items like this:
m_bitmapDataArray->AddHead(new CBitmapObject(currentColor, count));
You can add things at the end (Tail) or anywhere in between.
Later I use this code to pull objects off the end and perform the proper functions on them like this:
CBitmapObject *next;<br />
next = (CBitmapObject*) m_bitmapDataArray->RemoveTail();
You'll get an error because the RemoveTail() returns a CObject but my class is called CBitmapObject so you can recast CObject because CBitmapObject inherits CObject things.
I can create a CObList or CObArray collection of these classes derived from CObject. The CObArray works just like a regular array, with indices. CObList is more like an advanced doubly-linked list. You can add/remove from the head of tail of the list, or insert new objects at a particular location, etc...
If you can rearrange your project if it's more convenient to make a class derived from CObject to describe your entire device or however you care to use it, it might help out a lot. Hope this helps, good luck.
|
|
|
|
|
Thanks for all the peep's taking time to look:
CInternetSession session("FTP");
CFtpConnection* pConn=NULL;
pConn = session.GetFtpConnection(server,username,password,port,1);
pConn->GetFile("c:/data/","c:/data1/",TRUE,FILE_ATTRIBUTE_DIRECTORY);
As soon as this is run:
-----------------------------------------
Debug Assertion Failed!
File: inet.cpp
Line: 1731
-----------------------------------------
The Line reads something like this:
ASSERT(!(dwAttributes & FILE_ATTRIBUTE_DIRECTORY));
WHAT THE HECK?!
How am I supposed to download a directory??!?!?!?!?!?!?!!?
Everytime I include FILE_ATTRIBUTE_DIRECTORY it "Assert Fails" there!?
ANY HELP PLEASE PLEASE PLEASE!
|
|
|
|
|
Sorry:
*BUMP* Please take the time and help me if you can... I will love you!
|
|
|
|
|
#pragma once
template<class t="">
class Complex1
{
public:
Complex1(t _re, t _im) : re(_re), im(_im)
{
}
private:
t re, im;
};
/////////////////////////////////////////////////
#include "stdafx.h"
#include "complex1.h"
int _tmain(int argc, _TCHAR* argv[])
{
Complex1 <double> d1;
return 0;
}
error C2512: 'Complex1<t>' : no appropriate default constructor
available
with
[
t=double
]
|
|
|
|
|
When you write Complex1<double> d1; the compiler looks for a default constructor, which is a constructor with either no parameters, or parameters all with default values. The class Complex1 has no such constructor, so the declaration of d1 is illegal. You need to specify two values to be passed to the two-parameter constructor:
Complex1<double> d1(0,0);
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Mike,
Tried your advice,
Complex1<double> d1(0,0);
Also tried
Complex1<double, double=""> d1(0,0);
still doesn't compile...!!!!!
(7): error C2226: syntax error : unexpected type 't'
(7): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
(9): error C2661: 'Complex1<t>::__ctor' : no overloaded function takes 2 arguments
with
[
t=double
]
and
[
t=double
]
|
|
|
|
|
Im kinda new at this stuff, (so keep that in mind) but I think I see a couple of problems.
template sould be followed by (class t)
That is where you declare the new identifier type "t ". So that the compiler knows that this will be an acceptable data type when it sees it.
Second thing I see, is that you dont have much of a constructor for your class.
You declared a function within the Complex1 class. You named it Complex. But I dont see anywhere that you have defined what the function will do. I beleive the class is also unusable because the variables within it (t re , and t im ) are uninitialized. (Again, no constructor.)
Are you trying to do something like this?
<br />
template<class t><br />
Complex1<br />
{<br />
public:<br />
Complex1();<br />
void Complex(t re,t im);<br />
<br />
private:<br />
t<br />
re,<br />
im;<br />
};<br />
<br />
<br />
#includes...<br />
<br />
Complex1::Complex1()<br />
{<br />
re = 0;
im = 0;
}<br />
<br />
void Complex1::Complex(t r, t i)<br />
{<br />
t re = t r;<br />
t im = t i;<br />
}<br />
<br />
void main()<br />
{<br />
.<br />
.stuff<br />
.<br />
}
I hope this helps.
Travis
|
|
|
|
|
Hi,
Have you managed to solve this problem as yet. If not,
here is your solution....
//////////////////////////////////////////////
//complex1.h
#pragma once
template <class t>
class Complex1
{
public:
Complex1(t _re, t _im) : re(_re), im(_im){}
private:
t re, im;
};
//end of file
and ...
///////////////////////////////
//main.cpp
#include "stdafx.h"
#include "complex1.h"
int _tmain(int argc, _TCHAR* argv[])
{
Complex1 <double>d1(1, 0);
return 0;
}
// end of file
Regards,
David
|
|
|
|
|
Hello,
I'm a newbie to this forum. I tried to use search engine but with no help. I hope my question won't annoy you.
I'm trying to write a small database using MS Visual Studio 6 using C++.
My problem is following:
I need my database to have data entered in editboxes and checkboxes; -> this is the part i can deal with -> saving using MFC Serialization
My problems is:
- I need to have bitmaps i can draw on with colours and add some text on it
- save it to one file together with other data from editboxes, checkboxes
If anybody could help me with some sample source code, or a tutorial about my problem.
Thank you in advance for help.
Sorry for my spelling/gramar I'm not a native English speaking person.
|
|
|
|
|
A quick question... How does one sent the '\' character via the SendInput? I have managed to work out how to send other smybols, just can't workout how to send others.
Thanks for the help.
|
|
|
|
|
Well you haven't described the precise problem. Maybe you just need to use '\\'
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
The "Virtual Key Codes" page says this:VK_OEM_5 Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key Unfortunately it gives no guidance about what to do on other OSes or keyboard layouts.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks.... VK_OEM_5 appears to be the one I am after... well it comes up as a \ on my UK keyboard. -- Justin
|
|
|
|
|
Dear all
I want to launch a process from another process. I have tested "WinExec", "CreateProcess", "ShellExecute" and "ShellExecuteEx" APIs. In all of them, the lanuched process becomes child of the caller process. But I need that lauched proccess does not have a parent or has another parent e.g. "explorer" process.
Indeed I have a Windows Service which I want to launch a GUI application from it. In addition I don't want to set Service as an Interactive Service.
Any help would be appreciated
|
|
|
|
|
Masud Alipour wrote:
But I need that lauched proccess does not have a parent
It looks like the CREATE_NEW_PROCESS_GROUP flag to CreateProcess () will do that.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Dear Mike,
I am trying to do the same, but using CREATE_NEW_PROCESS_GROUP will not make the launched process be a direct descendent of "explorer.exe". Is it because the calling process that calls CreateProcess() is not a parent?
What I mean is, imaganing the following process tree from top to bottom.
explore.exe-->A.exe->B.exe
The calling process is "B.exe", which calls CreateProcess()with CREATE_NEW_PROCESS_GROUP to create "C.exe". And I found "C.exe" becomes a child process of A.exe, instead of "explorer.exe"
Is it normal? Is it possible to move "C.exe" the be at least the level as "A.exe"?
Thanks in advance,
Johnny
|
|
|
|
|
Thanks for your patience....
I was looking at the call stack to my very resiliant problem and I noticed that the dll causing the problem is uxtheme.dll. I've heard in my travels that this is a dll for themes and third party theme apps use an edited copy of this dll to get their themes to use the API for themes. Now, I recently stopped using WindowBlinds (a themeing program) around when this problem began. However possible, this could be giving me the problems. I just now started up WindowBlinds and ran my program and guess what, no crash.
My first feeling is anger and extreme confusion as to how a dll for themeing can throw a wrench in the gears. My next feeling is that I don't care a lot why because I've had this on my mind for too long. How can I get my app to work without WindowBlinds installed, i.e. with the default uxtheme.dll?
|
|
|
|
|
Hello,
I am trying to use a DLL file which is compatible with C and C++.
When i run my program i get the following error:
"The specified module could not be found."
I used the software "Dependency Walker" to check the DLL and i got the following error for the file MPR.dll which i think it's a system file:
"Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module."
Can someone tell me what am i doing wrong?
I have no idea how to solve this.
Thank You Very Much,
Miguel
|
|
|
|
|
It's Show your dll is itself depenedent on some other dll for proper functioning. i.e. let us nderstand by that by this diagram
your APP----calling DLL-> MY.dll -----Which is dependent on---> Dependent .dll
now there is no Dependent.dll in your computer, so your my.dll can't get required function from dependent.dll to function properly.
For solving this problem , open the dll in the DEPENDS , check for missing dll for your dll.
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
I want to be able to write to multiple files all at once.. this is going to lead me into writing to multiple USB devices at the same time..
Any idea on how to go about implementing simultaneously file output?
Thanks
|
|
|
|
|
Read up on 'IO Completion Ports'.
About as simultaneous as you can get (at elast your thread is not blocked waiting for the IO to complete).
|
|
|
|
|
Dear Sir
I wounder to know the mfc that used to open files (or to run exe files) within the VC++ project.
Thanks for Assistant
|
|
|
|
|
Hi all,
I am working with ADSP BF533 who's software is very much similar to VC++.
Let me explain the out line of my code and then tell my problem
----------------------------------------------------------
void main(void)
{
all the innitializations.....all other functions are called here
while(1)
{
for (i =0;i<100;i++)
-----
-----
if( a cetrain condition is met)
{
fp = freopen("", "a+", stdout);
printf("\n\r================\n\r");
printf("%f\n\r",azm);
fclose( fp);
}
}
}
-----------------------------------------------------------------------------------------------------------------------
so I don't think I can open and close the file outside the loop(as all my code is there inside "while(1)" loop.(do let me know if there is a possibility to open and close a file only once even in this situation,If i can do this then my problem is solved)
also I have noticed that I am able to print as many times as I want before closing the file once.
but after I open and close the file for the 1st time,i am able to open the file for the second time but I am not able to close the file for the second time....
here i am trying to send the data out from the processor's memory back to the "terminal screen"....through the UART
so tried to debug the code then i realised that for some reason the UART_LSR registers is not being reset to 0x0060 as it should be done after each transfer is complete.....this situation araises only when i try to close the file for the second time (obvisouly after i open the file for the 2nd time)...
SO NEED HELP FROM THE EXPERTEIS ...
thanking you all in advance and hope to hear from u all soon
with best regards,
shwetha
|
|
|
|
|
why the COM can not be deleted even it has been unregistered?
windows shows message "it is used by system", how to delete the COM without reboot system?
includeh10
|
|
|
|