|
Your data class seems to be mixing/combining the list itself and the nodes within the list.
class data
{
public:
data()
{
previous = NULL;
next = NULL;
}
private:
data *previous;
char name;
int pnum;
int gpa;
data *next;
}; Now create a class that adds/deletes data nodes within a list.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
Disclaimer: I am pretty new to MFC and may be asking something very naive, but your help would be really appreciated.
What I am trying to accomplish:
display images that may be stored on the users local machine, on a mapped network drive or a webfolder.
Problem:
1. unable to open image files on mapped network drives and webfolders.
2. unable to use CFileDialog to give me paths for webfolder or network drive paths that I can persist for reopening those files later - what I get is a temporary internet file path on the local machine.
What I have tried:
using CFile to open webfolder files - failed. May be I don't know how to construct the filepath. Or maybe I need a different API altogether.
Any help in this regard would be highly appreciated - specifically code snippets (please be kind and bear in mind that I fairly new to MFC)
Thanks,
Anuj
|
|
|
|
|
Hi.
I'm trying to pass a 2D array to my DLL. I can pass a 1D array, however I'm not sure how to work around a 2D. Any suggestions? I guess I just really want function Func2 to work. Is there a better way than to use a pointer to a pointer?
This is what I have...I'm just trying to grasp the concept, so the functions don't make any sense.
VBA CODE:
Private Declare Function Func1 Lib "C:\Documents and Settings\...\MyDLL.dll" _
(ByRef WeightArray As Double) As Double
Public Function temp(ByRef weightArr As Variant) As Double
Dim wArr() As Double
ReDim wArr(0 To 3) As Double
For i = 0 To 3
wArr(i) = weightArr(i + 1)
Next i
temp = Func1(wArr(0))
End Function
C++ CODE:
#define DllExport __declspec( dllexport )
double __declspec (dllexport) __stdcall Func1(double *WeightArray)
{
return WeightArray[0];
}
double __declspec (dllexport) __stdcall Func2(double **WeightArray)
{
return WeightArray[0][0];
}
|
|
|
|
|
CK938 wrote: ReDim wArr(0 To 3) As Double
I presume this makes a 4-itemarray?
/-+-+-+-\
|0|1|2|3|
\-+-+-+-/ Would a 2D array (2x3) look like:
ReDim wArr(0 To 3, 0 to 1) As Double
/-+-+-+-\
|0|1|2|3|
|0|1|2|3|
\-+-+-+-/ CK938 wrote: This is what I have...
So does it work? If not, have you tried it?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well I would call my function in Excel as
=temp1(A1:C3)
So bascially taking in a 3 by 3
/-+-+-\
|0|1|2|
|3|4|5|
|6|7|8|
\-+-+-/
VBA:
Public Function temp1(ByRef weightArr As Variant) As Double
Dim wArr() As Double
ReDim wArr(0 To 2, 0 To 2) As Double
For i = 0 To 2
For j = 0 To 2
wArr(i, j) = weightArr(i + 1, j + 1)
Next j
Next i
temp1 = Func1(wArr(0, 0))
End Function
C++ DLL code:
double __declspec (dllexport) __stdcall Func1(double **WeightArray)
{
return WeightArray[0][0];
}
I tried calling =temp1(A1:C3) on my excel sheet and it crashed.
I'm pretty sure my DLL code is where the problem is, but I'm not sure how the parameter should be written. Do I use the ** or is there another way to write the function?
Thanks
|
|
|
|
|
Sorry...I posted the question as an answer
Well I would call my function in Excel as
=temp1(A1:C3)
So bascially taking in a 3 by 3
/-+-+-\
|0|1|2|
|3|4|5|
|6|7|8|
\-+-+-/
VBA:
Public Function temp1(ByRef weightArr As Variant) As Double
Dim wArr() As Double
ReDim wArr(0 To 2, 0 To 2) As Double
For i = 0 To 2
For j = 0 To 2
wArr(i, j) = weightArr(i + 1, j + 1)
Next j
Next i
temp1 = Func1(wArr(0, 0))
End Function
C++ DLL code:
double __declspec (dllexport) __stdcall Func1(double **WeightArray)
{
return WeightArray[0][0];
}
I tried calling =temp1(A1:C3) on my excel sheet and it crashed.
I'm pretty sure my DLL code is where the problem is, but I'm not sure how the parameter should be written. Do I use the ** or is there another way to write the function?
Thanks
|
|
|
|
|
CK938 wrote: Do I use the **
A pointer to a pointer does not make much sense (when communicating with VB).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Using the calling convention to function temp1 [temp1(A1:C3)]...how should I go about writing my DLL?
I know that calling the function that takes in a 1D array works, but I'm not sure how to work about a 2D. I only know how to create a 2D array in C++ by:
int **temp = new int*[3];
for (int i = 0; i < 3; i++)
{
temp[i] = new int[3];
}
|
|
|
|
|
Does anyone know how to programmatically clear the debug output window in Visual C++ 2003.
Is there some sort of command or Macro to clear it before a TRACE for example?
|
|
|
|
|
I don't think there's a C macro for this, but you might check out some sort of VC add-in.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
or use a bunch of these:
TRACE(_T("\n"));
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not quite what I had in mind but I guess that technically covers what I asked for.
I was hoping for some funcky escape sequence in TRACE that would "clrscr" or whatever that old DOS command was.
|
|
|
|
|
It gets cleared each time you start the program via F5. And, at least for me, all new text is added to the bottom and scrolled up accordingly (i.e., I always see newly added text).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Same here.
I just occasionally come up with trace sequences that kinda get out of hand and in some unique circumstances, it would help to have the debug window "reset" to help my eyes track the start of the sequence better/faster.
Right now I put a trace in with a hiddeous, jumps out at you, string to help me find the start of the last iteration of trace sequences.
Thought I'd check with the rest of you to see if someone had ever come across something like that before.
Thanks for the input.
|
|
|
|
|
Heh I tried a formfeed - no love there.
I haven't dug into the internals of how these messages get routed to a debug window,
but I always assumed the messages are just written and it's up to the receiver to deal
with them.
Therefore, even if there was an extension to the IDE that did this, I'm not sure how it
could be used programmatically at runtime.
I'm interested in seeing a solution though.
Good luck,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No luck here either.
However, Hans Dietrich brought up "SysInternals DebugView" in another post in the thread. It doesn't do the clear screen thingy but it has a highlighting feature that is pretty cool. I had been meaning to dig through all those Sysinternal utilities someday. So far, the regmon (I think that's what it's called) has been the only one I've found I can't live without.
Thanks for the help.
|
|
|
|
|
You should give DebugView a try. You can set filters on lines with specific words - like 'ERROR' or 'WARN' - and DebugView will colorize those lines according to the colors you set.
|
|
|
|
|
That's sweet.
It's picking up traces from any debug exe run on the machine with Visual Studio running.
I downloaded the whole sysinternals collection right after MS bought them in case they were going to remove them from circulation but I never noticed that one before.
thanks for the heads up.
|
|
|
|
|
You can use the "exclude filter" option to exclude any unwanted lines. Sometimes, when you are reading lines in DebugView, the cursor will suddenly junp to bottom, because some other app has written debug output. I just add exclude filter to stop cursor from jumping around.
I also have a number of "5 character" filters defined - for example, '~~~~~', '-----', '=====', etc. - each with a different background color. I add 5-character sequence to end of TRACE string, for lines I want to watch for. It makes it very easy to see that line in TRACE output.
I once tried to add '*****' as filter, but everything turned that color! DebugView uses it as wildcard character. LOL!
|
|
|
|
|
Thanks for the advice and guidance.
|
|
|
|
|
Thanks Hans!!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am writing an event handler for the menu bar. In response to the WM_COMMAND message, my WndProc is supposed to send wParam to the function like this:
...<br />
case WM_COMMAND:<br />
guiObject->OnMenuSelection((UINT) wParam);<br />
...
Here is the code for the menu handler:
void GuiObject::OnMenuSelection(UINT menuID)<br />
{<br />
switch(menuID)<br />
{<br />
case ID_FILE_QUIT:<br />
break;<br />
default:<br />
break;<br />
}<br />
}
So why is the compiler giving me this error? How do I fix it?
|
|
|
|
|
What is ID_FILE_QUIT defined as?
Mark
<br />
<br />
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It's defined in the resource file. Visual Studio's resource builder made it.
#define ID_FILE_QUIT 40001
Right now, it's the only menu item there is.
|
|
|
|
|
Hmm I can't reproduce that.
resource.h is included somewhere?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|