|
Hi,
I need to send some data from one application to another(MFC).can anybody tell me what is the best way to do it.I may need to invoke a function of one application from another,or i may use any other method to send a buffer across apllication.
Can anybody help me regarding this.
I badly need it.
|
|
|
|
|
Window messages?
Define your custom message and handle it in your app. Use SendMessage() to send your data!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Thanks Rickard,where can i get the info regarding custom masseges.I am a begginer.
|
|
|
|
|
You can use memory mapped-files perhaps ?
This is a file that is mapped into memory and you can put data in it. You can use a pointer on it to retrieve data !
Take a look at the MSDN documentation (CreateFileMapping, MapViewOfFile, ..)
Hope this helps
|
|
|
|
|
Hi ,
Thanks a lot for suggestion.
Can you please tell me where i can get a good tutorial on this.
|
|
|
|
|
Sorry, no. I don't know any tutorial.
What I can do is perhaps send some code files but it's just some separate files so I don't think it will help you very much.
Can you give me your e-mail adress?
Ced
|
|
|
|
|
I don't know it's good enough?
can anyone sell it;about 300$
Audio chat web server,coded by C++,can run on windows/liunx
ease to install and use.very good audio quality.
|
|
|
|
|
Hi all ,
Can we subclass scrollbar control of editbox, combobox, listbox... in MFC?
How to do it? Please help me!
Thanks alot
|
|
|
|
|
It's no answer, isn't it ?
So boring
|
|
|
|
|
how do i set the font and color of individual controls in an mfc dialog box.
also can i set the foreground color of a CButton.
can someone post some code.
rIsHaBH
|
|
|
|
|
The message you need to handle is different depending on what control you need to override. You should look at the WM_CTRLCOLOR(x) messages. For a button the WM_CTLCOLORBTN would be sent to your dialog ( parent window ) when before the button is drawn. This will allow you to set the foreground color of the dlg. The others are located here:
WM_CTLCOLORBTN[^]
WM_CTLCOLORDLG[^]
WM_CTLCOLOREDIT[^]
WM_CTLCOLORLISTBOX[^]
WM_CTLCOLORSCROLLBAR[^]
WM_CTLCOLORSTATIC[^]
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Any advice as to which is a good way to add CD data burning capabilities to an app ? Anyone here have any experiences with an SDK or Control?
I think if I could stick to XP that I could use the Image Mastering API, unfortunately not all users have XP yet.
Regardz
Colin J Davies
* WARNING * Save your work This link is to reboot your PC
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
I've heard people say that there's a free Nero SDK that's a good one to use, but I've never done CD burning myself, so I don't know.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
The SDK is free, but you need Nero installed for it to work...
-
|
|
|
|
|
I'm trying to grab text that is already in a multi-line edit control, append more text to it and then reset the edit control to the new text. Unfortunately I'm getting memory errors after one or two times of performing this process.
Here is the code I'm using:
int cTxtLen = GetWindowTextLength(hwndEdit);
pszMem = (LPTSTR) GlobalAlloc(GPTR, cTxtLen + 1);
GetWindowText(hwndEdit,(LPWSTR)pszMem,cTxtLen + 1);
List = pszMem;
GlobalFree(pszMem);
// run List through a function that appends more text
SendMessage (hwndEdit, WM_SETTEXT, 0, (LPARAM) List.GetBuffer(0)) ;
List.ReleaseBuffer();
Anyone see what might be causing these errors?
Thanks,
stf
|
|
|
|
|
Not good code. You aren't checking any return values. You are using old 16bit Global memory functions. You haven't said what the errors are, which makes helping quite difficult. Have you ruled out "function that appends more text" isn't the culprit.
What is wrong with:
GetWindowText( &List ) assuming you have a CWnd or
CWnd::FromHandle( hwndEdit )->GetWindowText( &List ) if you don't.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Also note:
cTxtLen + 1
should be
cTxtLen + sizeof(TCHAR)
Trust in the code Luke. Yea right!
|
|
|
|
|
If my memory serves me right then you should always use ::GlobalLock on the handle returned by ::GlobalAlloc and use the pointer returned by ::GlobalLock instead. Also, you are casting your pointer to LPWSTR - are you compiling with UNICODE enabled? If so, you should be allocating cTxtLen * sizeof ( WCHAR ) instead of just cTxtLen. If not, you should just cast to LPTSTR. Anyway, multiplying by sizeof( TCHAR ) when allocating is always a good idea to be Unicode compliant.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Thanks a lot for the help everyone. Here is what I've got now:
int cTxtLen = GetWindowTextLength(hwndEdit);
if(cTxtLen > 0)
{
pszMem = (LPTSTR) GlobalAlloc(GPTR, cTxtLen * sizeof(WCHAR));
if (pszMem == NULL )
OkMessage (hwnd, TEXT ("Alloc failed!!!"), TEXT ("\0")) ;
pszMem = (LPTSTR)GlobalLock(pszMem);
if (pszMem == NULL )
OkMessage (hwnd, TEXT ("GlobalLock failed!!!"), TEXT ("\0")) ;
GetWindowText(hwndEdit,(LPWSTR)pszMem,cTxtLen + 1);
List = pszMem;
GlobalUnlock(pszMem);
pszMem = (LPTSTR) GlobalFree(pszMem);
if(pszMem != NULL)
OkMessage (hwnd, TEXT ("GlobalFree failed!!!"), TEXT ("\0")) ;
SendMessage (hwndEdit, WM_SETTEXT, 0, (LPARAM) List.GetBuffer(0)) ;
List.ReleaseBuffer();
}
Neville Franks: I have already ruled out the function that is appending the text as not being a problem. I'm getting errors like:
The instruction at "0x77f5215e" referenced memory at "0x00000004". The memory could not be "written".
Click on OK to terminate the program
Unhandled exception at 0x77f536f7 in list.exe: 0xC0000005: Access violation writing location 0x003a0043.
Also I'm not that familiar with MFC at the moment which is why I'm trying to stick with just the API functions.
This code does fine for 5 times through but on the sixth time I get an error like the ones listed above. Both seem to be dealing with "writing" the memory, I'm not sure if it makes a difference or not but the variable "List" is of CString type. Also, could it be overflowing the edit control?
Thanks for the help,
stf
|
|
|
|
|
Hi all,
Is there any way to enum all DCs in a domain, using ADSI or DS API on a win2000 box ???I have already done this sometime ago using NetServerEnum (NETAPI).
I´ve found DsGetDcOpen/DsGetDcNext but they require Windows XP or later...
I´ve tried the "Role Property" for IADSComputer Class, but the WinNT and LDAP providers doesn´t suport it...
Thanks in advance
|
|
|
|
|
I have a combo on a toolbar. i'm trying to capture CBN_DROPDOWN via ON_CONTROL_REFLECT, but it looks like the WM_COMMAND messages are getting lost somewhere. i know the CComboBox class works (captures the msg) if i put one on a normal modal dialog. but, when it's on the toolbar, that message never shows up - i'm assuming the toolbar eats it.
so... does anyone knof if there's a trick to making the CComboBox/CToolBar combo play nicely ?
here's how i create the combo:
m_toolbar.m_combo.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL|CBS_DROPDOWNLIST|CBS_HASSTRINGS,
rect, &m_toolbar, IDC_DE_TB_COMBO));
here's the CComboBOx's message map stuff:
BEGIN_MESSAGE_MAP(CItemDataCombo, CComboBox)
ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropdown)
END_MESSAGE_MAP()
ideas?
-c
|
|
|
|
|
I just tried this with a combobox on a toolbar in one of my programs, and the CBN_DROPDOWN handler in the combobox was called properly. My toolbar is a custom toolbar class derived from a derivative of CToolBar, but I don't really have anything fancy setup.
Here's my creation code (in a member of the toolbar class):
if( !c_oCompression.Create( WS_CHILD|WS_TABSTOP|CBS_DROPDOWNLIST, CRect( 0, 0, 0, 0 ), this, ID_COMPRESSION_COMBO ) )
For the test, I just quickly added a derived combobox class to my project, and swapped out the default combobox class with the new class. Then I wired up the ON_CONTROL_REFLECT and it works perfect.
So, I'm not sure what it is, but there must be some difference between the way my program sets it up and the way yours does.
Chris Richardson Terrain Software
|
|
|
|
|
try this way
Chris Losinger wrote:
BEGIN_MESSAGE_MAP(CItemDataCombo, CComboBox) //{{AFX_MSG_MAP(CItemDataCombo) ON_CBN_DROPDOWN(IDC_COMBO, OnDropDown)
//}}AFX_MSG_MAPEND_MESSAGE_MAP()
|
|
|
|
|
How can I start a VPN connection programatically? Also creating the VPN connection is of concern too. What set of APIs will be useful RAS or TAPI? Are there any articles or tutorials on doing this sort of thing?
|
|
|
|
|