|
Greetings, and apologies if you have already read this under COM.
I have created a DLL using the ATL COM AppWizard, and have successfully added a class and functions. I was also successful in create and an expose an enum by including
typedef enum {aa,bb,cc} testEnum;
in the .idl file.
PROBLEM: how do I add definitions of global members? In other words, I would like some constants, variables and functions to be immediately available to VB applications that use my dll, in the same way that the "Load" method or the "App" property become available once the a reference to VB6.olb is created.
Thanks is advance,
zgilboa
|
|
|
|
|
How does a Windows "VIEW" page send a BEEP code (ASCII 0x07) to the console. The _putch() function does not do it from a VIEW.
|
|
|
|
|
MessageBeep(-1) maybe?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you. Of all the books I have on programming Windows none mentions MessageBeep(). I found that just Beep() works as well.
|
|
|
|
|
And maybe you will need to virtual key code so see this link[^]
|
|
|
|
|
WhiteSky wrote: And maybe you will need to virtual key code so see this link[^]
hummm....
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
I think maybe he will be these codes? maybe not;)
|
|
|
|
|
It's been awhile since I've used this, but I think system(07) will do it. the prototype for system() is in stdlib.h
none
|
|
|
|
|
My question is quite elementary in nature but i have really forgotten how to move about this thing. i am facing problem with making linked lists without using the header for them in visual c++. i mean i want to make a class for the purpose.
any help would be really appreiciated. the crude code that i have written till now is given. i want to know what really i am missing here.
#include<iostream>
using namespace std;
class data
{
private:
*previous;
char name;
int pnum;
int gpa;
*next;
public:
void add()
{
}
void del()
{
}
void average_gpa()
{
}
};
int main()
{
*data=new data;
return 0;
}
Muhammad Shemyal Nisar
-- modified at 22:58 Tuesday 7th August, 2007
|
|
|
|
|
Hrmmm, the question is written reasonably well, spelling and grammar are quite passable, although it doesn't really explain what you're trying to do.
Pity it's in the completely wrong forum....
I have no blog...
|
|
|
|
|
Heh. Was this moved here from the ASP.NET board?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Heh. Was this moved here from the ASP.NET board?
offcourse!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
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
|
|
|
|