|
In some of the newer versions of Rich Edit DLL, you can actually create tables. They do have limits tho... Read the MSDN on it and see if it will do what you want.
Before we saw that you can do this, we created one that emulates words table.
Wrongway
|
|
|
|
|
i want to add string to a combolistbox of a parent class
who can tell me how to do this .
|
|
|
|
|
One solution is messages. Send a message to the parent window and have it update the control.
Kuphryn
|
|
|
|
|
I am writing a C++ DLL that needs to return an array of my UDT structure to my VB Application. My problem is I am getting an automation error when I try to delcare any variables which are of the structure type I declared in C++
=====================================
I have a structure defined in C++ as follows
typedef struct structCONTACT
{
char* name;
char* email;
}CONTACT;
======================================
My GetContacts Function is defined as follows
CONTACT* __stdcall GetContacts()
{
CONTACT* c;
blah blah blah...
return c;
}
======================================
In visual basic, I set a reference to my DLL file and type the following
Dim cArr As CONTACT ' Causes Automation Error
cArr = GetContacts() ' Causes Automation Error
======================================
Why does this cause an Automation Error? In my DLL i have a resource file that has this code
1 typelib MyWab.tlb
This allows VB to access my C++ datatype with out having to distribute the .tlb file.
My DLL compiles and VB can see my structure, it can also see my function GetContacts(), however it will not run becase it give the following error:
"Compiler Error: Variable uses an Automation type not supported in visual basic."
I think the char* inside my C++ structure is okay, I beleive the problem is the fact that im trying to return an array of the CONTACT structure, and VB does not like this becase it does not recognize CONTACT as a supported Automation Data Type.
How can I make it a supported Automation DataType?
Thanks in advance
|
|
|
|
|
In the design, CONTACT structure is not COM compliant data type. One solution is to design a custom proxy/stub for custom marshaling.
Kuphryn
|
|
|
|
|
Or design your DLL function to accept a variant of type SafeArray. Element 0 is the first string and Element 1 is the second string.
|
|
|
|
|
Thank-you for your reply.
If I am to use SAVEARRAY what would my function signature look like I have not used SAFEARRAY before and do not quite understand the definition in the MSDN. This SAFEARRAY would it actually be an array of CONTACT or how would that actually work?
Thanks again
|
|
|
|
|
Hummm, no one seems to know the answer to this post...
Just an update, I have changed my C++ code so that the GetContacts function no longer returns a CONTACT data structure, instead I pass a reference to a DataStructure in as a parameter.
I then added the following line in the General Declorations Part of VB
Private Declare Function GetContacts Lib "MyWab.dll" (ByRef sPathToWABDLL As String, ByRef c() As CONTACT)
Now im getting a completely different error "Bad DLL calling convention" But if I take out that VB Declare, I get an automation error.
What am I doing wrong?
|
|
|
|
|
I have multiple processes on the same machine listening for datagrams on the same UDP port.
I'm setting up each socket to reuse the address like this:
BOOL bTrue = TRUE ;
if ( setsockopt(hSocket , SOL_SOCKET , SO_REUSEADDR , (char *)&bTrue , sizeof(bTrue) ) != 0 )
and the bind() is working fine as well:
struct sockaddr_in sockAddr ;
sockAddr.sin_family = AF_INET ;
sockAddr.sin_addr.s_addr = inet_addr( "127.0.0.1" ) ;
sockAddr.sin_port = htons( 1001 ) ;
if ( bind( hSocket , (sockaddr*)&sockAddr , sizeof(sockAddr)) != 0 )
But when I broadcast a message, only one process gets it (the first one to open the socket). Is this a limitation of UDP or have I missed something?
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Taka Muraoka wrote:
Is this a limitation of UDP or have I missed something?
There are 3 uses of SO_REUSEADDR:
1. Allows a server to listen on an address/port that already has an established connection on it, ie. TCP only.
2. Allows multiple binds on the same port, as long as they use different IP addresses. This works with either multiple processes or one process.
3. Allows completely duplicate binding (same IP address and port), but only if the sockets implementation supports multicasting.
Your situation is the third case. Unfortunately, the Windows Sockets IPv4 implementation does not support multicasting, so the bind will work, but only the first socket to do the bind will receive any datagrams.
In any case, IPv4 only supports multicasting addresses that are from 224.0.0.0 to 239.255.255.255
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
Bugger. I'm working around it now anyway - it's pretty ugly but wtf...
Thanks for the help.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
How can i search for characters like " and \ in an edit control?
-- Steve
|
|
|
|
|
First read the text from the edit control.
CString strMyString;
GetDlgItem( IDC_MYEDIT )->GetWindowText( strMyString );
// Search for "
int nIndex1 = strMyString.Find( '"' );
// Search for \
int nIndex2 = strMyString.Find( '\\' );
If you have more than one occurences of each of these characters, use int CString::Find( TCHAR somechar, int nStart )
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|
Dear everyone,
i meet one problem.
Our application need the following function:
when user change the window size, the controls in the window need resizing, and the font in the controls need be modified, too.
I think it is some difficult and complicated, could you tell me how to implement and where could find the article or resource about it?
Welcome any suggestion!
Good Luck
|
|
|
|
|
Handle the WM_SIZE message in the parent, and call the MoveWindow() or SetWindowPos() functions for all the children.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
There are lots of code here in CP regarding on this, I've been using for a long time the ControlPos class that it's very easy to use...
Hope this helps...
|
|
|
|
|
when we transfer one polymorphic object from one side of the network to other side of the network computer then we
unmarshal the objects string into it polymorphic object.
then how super class knows that
where and what is its sub class object stored in super class pointer out of many subclass objects?
r00d0034@yahoo.com
|
|
|
|
|
I am working on a program where I keep background textures in a separate DLL (for simple upgrade possibilities).
I use LoadBitmap in the DLL and I export the pointer to the asociated CBitmap to the application.
Everything works fine, except that refresh is quite slow now.
Does anyone know/recognize this behaviour , or did I do something else wrong?
If someone has a clue and solution, please let me know.
Bert....
|
|
|
|
|
Hi,
I created a splitter for SDI with two views and one document, left view just for the snapshot of my main (right) view.
My question is, haw to do my main view (right frame) always active even if I click on the left frame???
Thank you.
|
|
|
|
|
In your left view, override OnActivateView() and call the splitter function SetActivePane(0,1)
|
|
|
|
|
Hey guys
I am using MFC -> File Open dialog box, which works fine.
I have noticed other applications use a different style of dialog box wich has quick buttons on the left that brings the navigation tree in the open dialog box to those locations.
For example in Microsft Word, when you go File -> Open, there are 5 buttons on the left (History, My Documents, Desktop, Favorites, My Network places)
I would also like the same type of "File Open" dialog box. How do I impliment this. I have searched the MSDN documentation and have come up with nothing.
Any help appreciated
George W
Software Developer
www.zsystems.ca
|
|
|
|
|
It's called the "Places" bar, and comes with a new version of commdlg.dll. So instead of using CFileDialog, you'll have to use GetOpenFileName(). If the OPENFILENAME structure uses a hook procedure (or the OFN_ENABLETEMPLATE is set), you will get the old-style dialog; otherwise, you will get the one with the "Places" bar. This explains why MFC apps get the old dialog—because CFileDialog, like all MFC common dialogs, uses a hook procedure. Search MSDN, or the Web, for details.
|
|
|
|
|
Thanks for help
I will look into this.
George W
Software Developer
www.zsystems.ca
|
|
|
|
|
Suppose I have a class with a few member variables, and one of them is a CArray object, e.g.:
CMyClass {
...
private:
int var1, var2, var3;
bool flag1, flag2, flag3;
CArray <int,int&> arSomeArray;
};
If I didn't have that CArray member, I could simply write:
CMyClass a, b;
a = b;
The assignment operator would be simply generated by compiler. But when CArray is there, compiler cannot generate default assigment operator, so I have to add to the class:
CMyClass& operator= (CMyClass& src){
var1 = src.var1;
var2 = src.var2;
var3 = src.var3;
flag1 = src.flag1;
flag2 = src.flag2;
flag3 = src.flag3;
arSomArray.Copy (src.arSomeArray);
return *this;
}
Not only that it is very tedious writing a few dozen of "x = src.x ", it is also prone to bugs. Like later I will add a variable to the class and might forget to add it to the operator= function.
Is there a way to write something like below?
CMyClass& operator= (CMyClass& src){
dear_compiler_do_what_you_can_with_all_the_variables_i_ll_take_care_of_the_rest();
arSomArray.Copy (src.arSomeArray);
return *this;
}
Thanks
|
|
|
|