|
OK...I have looked at many different articles about threads, all say the same thing, but when i do it, it says this:-
'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'void (void)'
so i wondered if there is an include that i need or something?
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I'm not any old Eclypse, i'm TheEclypse..get it, got it, good!"
|
|
|
|
|
AfxBeginThead is in AfxWin.h, which should already be included in an MFC app-wizard generated application.
Post the code and somebody might be able to spot your error.
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
void CSpeakItDlg::OnSpeakit()
{
AfxBeginThread(DoSpeak, this);
}
void CSpeakItDlg::DoSpeak()
{
ISpVoice * pVoice = NULL;
if (FAILED(CoInitialize(NULL)))
{
AfxMessageBox("Error to intiliaze COM");
return;
}
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak(m_sText.AllocSysString(), 0, NULL);
pVoice->Release();
pVoice = NULL;
}
CoUninitialize();
}
UINT CSpeakItDlg::DoSpeak(LPVOID lpv)
{
CSpeakItDlg * me = (CSpeakItDlg *)lpv;
me->DoSpeak();
return 0;
}
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I'm not any old Eclypse, i'm TheEclypse..get it, got it, good!"
|
|
|
|
|
Is your DoSpeak thread function declared as static in the header?
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
declared as static??? excuse my not knowing anything.
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I'm not any old Eclypse, i'm TheEclypse..get it, got it, good!"
|
|
|
|
|
The thread proc must either be a static function of the class or a global function which is not part of any class.
It should return an UINT and take an LPVOID as parameter since that's what AfxBeginThread() expects
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
In your class header file:
class CSpeakItDlg {
public:
static UINT DoSpeak(LPVOID lpv);
};
|
|
|
|
|
'DoSpeak' is a method of CSpeahItDlg. AfxBeginThread expects standalone function prototyped like this:
UINT MyThreadProc(LPVOID pvParam);
pvParam gets the 2nd parameter passed to AfxBeginThread. Basically, you should just cast pvParam to CSpeakItDlg* and call DoSpeak method.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
How to change input of edit of another program in my own problem?
My program is following:
m_strTemp="E:\\vc\\MagnMod\\GEOMAGIX.EXE E:\\vc\\MagnMod\\US-2000.COF";
::WinExec(m_strTemp,SW_HIDE);
HWND* m_pwnd= FindWindow(NULL,"Geomagix: calculation of Earth's magnetic field
from Magnetic Models");
//m_pwnd->ShowWindow(SW_HIDE);
CWnd* m_wnd=m_pwnd->GetWindow(GW_CHILD);
CWnd m_pxwnd;
m_pxwnd.Attach(m_wnd->m_hWnd);
//char m_xtext[11];
m_pxwnd.SetWindowText("12");
First, I get the handle of the window in which edit is,then get the handle of the edit.But I can't get or set the characters of the edit.
"getdlgitemtext","setdlgitemtext","setwindowtext" all can't solve it.I have also tried other means,such as "sendmessage(hwnd,wm_get(set)text,0,.....)".
thanks!
|
|
|
|
|
Have you tried putting your strings on the clipboard and just sending WM_PASTE to the edit controls?
|
|
|
|
|
Hi,
I want to develop an application (under Win98) which
receives a call if someone connects and then send some files from a directory to the one who has connected.
Please help
Sameer
|
|
|
|
|
Does this design make any sense?
1. Using TCP/IP protocol.
2. run a server app on your PC, which monitor a predefined port all the time, to see if there is any request of file transfer.
3. on the other end of the link, run a client-like app, which tries to connect to your PC via that predefined port. Once connected, receive the file. After file is received in full, disconnect.
|
|
|
|
|
and if your server speaks HTTP (default listening port is 80), you do not even need to write a client.
|
|
|
|
|
I'm trying to fix a problem with the Windows Explorer Shell Context menu which I use in my app (ED). To be specific the "Send To" menu doesn't work.
I've been having a look at TrackItemIDContextMenu() in the "ITEMIDLIST management library" and "Send To" doesn't work there either. See this post..
I've also looked at Oz Solomonovich's WndTabs code which implements a "Shell Context" menu, which works but has some problems. It is missing any Folder items from the "Send To" menu, and "Open with" is broken, at least on WinXP pro. I've just reported these issues to Oz.
If possible I'd prefer to use the "Send To" menu as is, rather than Oz's code which creates its own "Send To" and "Open with" menus.
As Oz points out in ShellContextMenu.cpp "Send To" is a real pain. Hear brick wall.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
You are talking about "SendTo" and "OpenWith" and these are 2
different things.
"OpenWith" is implemented as a contextmenu extension so it can be
reused.
You have to implement IContextMenu3 for it to work though.
The "SendTo" you have to build yourself, just enum the contents using
SHGetSpecialFolderLocation() with CSIDL_SENDTO.
/Magnus
|
|
|
|
|
I update myself a little.
For "sendto" use
SHCONTF_FOLDERS|SHCONTF_NONFOLDERS
with the IShellFolder::Enumbjects() to get all items.
For "OpenWith", create the extension, query for IContextMenu2
and call IContextMenu2::HanldeMenuMsg() where appropriate.
(to get submenu for 2000/XP to work)
/Magnus
|
|
|
|
|
Part 3
Forgot the "fun" part to actually get something to
happen when you select something in the "SendTo" menu.
You have to.
Bind to the folder.
Query for IDropTarget
Create a IDataOBject with the stuff you want to send.
Call IDropTarget->DragEnter() and Drop().
Come to think of it, you probably want to operate on a normal
filesystem file.
Then do
GetDeskttopFolder()
ParseDisplayName() with path to file
Bind to the resulting pidl
call GetUIObejectOf with IID_IContextMenu
and then you should get the normal explorer menu
/Magnus
|
|
|
|
|
Hi Magnus,
It would be great if you could put all this together into a complete working sample.;) Adding it to TrackItemIDContextMenu() would be terrific.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
That might be a good idea, but i dont have the time to
do that right now.
Anyway as i wrote in the last part, if you want to
display the menu for a normal filesystem file you
dont have to bother with all this stuff.
Just ask the explorer to create it for you.
IShellFolder::GetUIObjectOf( IID_IContextMenu ) and you will get
it.
(you still have to call HandleMenuMsg() for the OpenWith menu to work ok)
/Magnus
|
|
|
|
|
Magnus H wrote:
That might be a good idea, but i dont have the time to
do that right now.
Yes I know the feeling only too well.
Magnus H wrote:
Anyway as i wrote in the last part, if you want to
display the menu for a normal filesystem file you
dont have to bother with all this stuff.
Just ask the explorer to create it for you.
IShellFolder::GetUIObjectOf( IID_IContextMenu ) and you will get
it.
(you still have to call HandleMenuMsg() for the OpenWith menu to work ok)
Are you talking about the "Send To" menu here? That is all I'm trying to get working now.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
Magnus H wrote:
That might be a good idea, but i dont have the time to
do that right now.
Yes I know the feeling only too well
Yes, and now it's the World Cup to, so everything else have to wait.
Neville Franks wrote:
Are you talking about the "Send To" menu here? That is all I'm trying to get working now
No, i tought you wanted the complete meny as it looks in the explorer.
If it's only the "SendTo" you want i think you have to do it the hard way.
/Magnus
|
|
|
|
|
Magnus H wrote:
IShellFolder::GetUIObjectOf( IID_IContextMenu ) and you will get
it.
(you still have to call HandleMenuMsg() for the OpenWith menu to work ok)
Yes that is what I'm doing, but I can't execute any "Send To" menu choices. "Send To" Menu items all have the same ID. ie. TrackPopupMenu() returns the same value regardless of which "Send To" menu item you choose.
PS. I do want the entire Explorer Menu, not just "Send To".
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
You shouldn't have to care about the id you get back, just pass it to
IContextMenu::InvokeCommand()
(It does sound a bit strange that you get the same ID though)
/Magnus
|
|
|
|
|
You can't use IContextMenu::InvokeCommand() for "Send To" selections. If you pass the "Send To" ID (which is always the same) Windows crashes your app. You need to use a drag & drop interface, but I can't see how to do that because I can't find out what was selected from the menu.
I'm working on building me own menu now, but I can't get and drives listed. eg. "3 1/2 Floppy, .."
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I can't seem to get the floppy listed either at a closer look, either
the flags to EnumObjects() are wrong, or windows add the floppy in addition to what is in the sendto folder. (I guess the later is correct...but who knows)
/Magnus
|
|
|
|