|
The "Start->Run" doing nothing but simple ShellExecute() . What you mean that it isn't working? So or you passed wrong parameters to it or the path doesn't exists.
Post an example of what are you doing with ShellExecute()
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
hWnd is a common editbox
int commandLength = ::GetWindowTextLength(hWnd);
LPTSTR szCommand = new TCHAR[commandLength + 1];
::GetWindowText(hWnd, szCommand, commandLength + 1);
LPTSTR szParameters = strchr(szCommand, ' ');
if (szParameters)
{
szParameters[0] = '\0';
szParameters++;
}
::ShellExecute(NULL, NULL, szCommand, szParameters, NULL, SW_SHOWNORMAL);::SetWindowText(hWnd, TEXT(""));
delete[] szCommand;
The command is run, but if I type an errouneous command, no errormessages are displayed. I would like ShellExecute to do that for me. I've tried several different parent-window handles as parameter, but no messagebox are displayed.
|
|
|
|
|
ShellExecute doesn't do the messagebox for you.
You need to check the return value and then display a messagebox by yourself
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank god it doesn't no less!!! Would sort of make headless applications hard to write.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I have "simple object",when I created it I accepted all default attribute.
Now I want to add Method with "callback" attribute,but after compile it return error:
method definition--->[id(4), helpstring("method KeyboardProc"), callback] HRESULT KeyboardProc(int nCode,WPARAM wParam,LPARAM lParam);
error---->error MIDL2304 : attribute invalid on a proc in an [object] interface : : [callback] [ Procedure ...
I also test this and get this error:
method definition--->[callback(4), helpstring("method KeyboardProc")] HRESULT KeyboardProc(int nCode,WPARAM wParam,LPARAM lParam);
error---->error MIDL2025 : syntax error : expecting ] or , near "("
***I also want the return vale to be "LRESULT" but I can not change "HRESULT" when I want to add Method.*****
|
|
|
|
|
I'm not quiet sure what you are trying to achieve here.
COM IDL is limited to certain data types and callback certainly isn't one of them. COM methods can only return HRESULTS, if you want to return a value it needs to be passed back as a pointer via the parameter list.
Michael
|
|
|
|
|
If you look up error 2304, it reads;
MIDL2304: attribute invalid on a procedure in an [object] interface
The specified attribute is not allowed on procedure in a COM interface.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I want my method return Keyboard messages?(It hook keyboard message)
What attribute my method should have and what it should return?
|
|
|
|
|
Hi, I was wondering if anyone out there knew of a place where I might either buy or obtain (open-source) a copy of an "intellisense" control, similar to that of Visual Studio? I am in the process of working on an editor and such a control would be awesome.
|
|
|
|
|
Didn't understand your post at all, lmao. But according to Subject, I see you want an Autocompletion.... The only thing.... Not ListBox, but ComboBox..
Well, look in MSDN for interface IAutoComplete
Hope this is what you want
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Hi, thanks for replying, however, I was trying to ask whether a "popup intellisense menu" existed as separate control. You know how in MSVC, after you type a "." or a "->", all the class members of the object you are dealing with will be displayed? I would like to incorporate "intellisense" into my very own, homegrown editor.
|
|
|
|
|
Try this:
http://www.ticz.com/homes/users/nlewis/index.html?target=intro
LEt me know if you have any questions on usage.
|
|
|
|
|
Dude. This is EXACTLY what I was looking for! Thanks a million.
|
|
|
|
|
What's wrong with the following?
#include <vector>
class kConfig
{
protected:
public:
typedef int (*cheese)(void*);
struct kconfig_handler{
char* settingName,
cheese handlerFunc,
void* pObject;
};
kConfig();
~kConfig();
void registerHandlers(kconfig_handler[] handlers);
int loadConfig(char* pchFilename);
private:
std::vector< kconfig_handler* > m_settingList;
};
I keep getting this error when i try to compile:
f:\software\katie\include\kconfig.h(24) : error C2146: syntax error : missing ';' before identifier 'handlerFunc'
That error refers to the line
cheese handlerFunc,
Stephen Caldwell
Blackfission, CEO
http://blackfission.myip.org:81
|
|
|
|
|
struct kconfig_handler {
char* settingName,
cheese handlerFunc,
void* pObject;
}; You have commas there instead of semicolons.
--Mike--
My really out-of-date homepage
"Hey, you wanna go to the Espresso Pump and get sugared up on mochas?"
-- Willow Rosenberg
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
No wonder, and to think I make structs all the time. How could that have happened? I guess age has caught up with me (17 years).
Stephen Caldwell
Blackfission, CEO
|
|
|
|
|
Heh, I type , instead of ; in for loops all the time and it bugs the heck out of me.
--Mike--
My really out-of-date homepage
"Hey, you wanna go to the Espresso Pump and get sugared up on mochas?"
-- Willow Rosenberg
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
When I help my team mate with VB occasionally I have trouble when I press ENTER because I can't help terminating the statements with a ';' and the VB auto syntax checker pops up the error dialog
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
How can I write my own stream?
I need to write a stream class and redirect cerr to it. Based on the class settings I will log it to a file or a database.
I need to use the class like below
#include <iostream>
#include <fstream>
int main()
{
std::ofstream logFile("out.txt");
std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
// do the actual work of the program;
// GUI code and event loop would go here
std::cout << "This would normally go to cout but goes to the log file\n";
std::cerr << "This would normally go to cerr but goes to the log file \n";
logFile << "This goes to the log file\n";
// end of program body
// restore the buffers
std::cout.rdbuf(outbuf);
std::cerr.rdbuf(errbuf);
}
But my class will log to the disk or log to a DBMS.
Regards,
Xavier
|
|
|
|
|
Here's one I wrote that uses WM_COPYDATA to send a line when it finds a \r
template <class chart,="" class="" traits="">
class DebugStr : public std::basic_streambuf<chart, traits="">
{
public:
DebugStr()
{
m_ParenthWnd = m_DebughWnd = NULL;
};
HWND m_ParenthWnd, m_DebughWnd;
protected:
std::string m_string;
int_type overflow(int_type c = traits_type::eof())
{
if (c != traits_type::eof())
{
if ('\n' == c)
{
// We check to make sure we have the HWND and it's still valid.
if (m_DebughWnd && ::IsWindow(m_DebughWnd))
{
COPYDATASTRUCT cds;
cds.cbData = m_string.size();
cds.lpData = (void*)(LPCSTR)m_string.c_str();
::SendMessage(m_DebughWnd, WM_COPYDATA, (WPARAM)m_ParenthWnd, (LPARAM)&cds);
}
m_string = "";
}
else
{
m_string += traits_type::to_char_type(c);
// If we have the parent window, but not the debug window, or it's become invalid,
// we call Init again and attempt tp find it.
if (m_ParenthWnd && (!m_DebughWnd || !::IsWindow(m_DebughWnd)))
{
SDebug::Init(m_ParenthWnd);
}
}
return c;
}
return traits_type::not_eof(c);
};
};
Through the details of my implimentation you should find a skeleton there you can use to create a stream.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I wanna play multiple AVIs,but a interval of silence occured when file1 finished and file2 is rendering.How can i avoid that ?
Any Pointer or hint will be appreciated !
Thanks a lot!!
|
|
|
|
|
Hi,
I am embedding MSWord In my application, using OLE automation.
Code As Follows
/*******************************************************************
This method encapsulates the process of embedding a Word document
in a View object and automating that document to add text.
*******************************************************************/
//Change the cursor so the user knows something exciting is going
//on.
BeginWaitCursor();
CWordContainerCntrItem* pItem = NULL;
TRY
{
//Get the document associated with this view, and be sure it's
//valid.
CWordContainerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//Create a new item associated with this document, and be sure
//it's valid.
pItem = new CWordContainerCntrItem(pDoc);
ASSERT_VALID(pItem);
// Get Class ID for Word document.
// This is used in creation.
CLSID clsid;
if(FAILED(::CLSIDFromProgID(L"Word.Document",&clsid)))
//Any exception will do. You just need to break out of the
//TRY statement.
AfxThrowMemoryException();
// Create the Word embedded item.
if(!pItem->CreateNewItem(clsid))
//Any exception will do. You just need to break out of the
//TRY statement.
AfxThrowMemoryException();
//Make sure the new CContainerItem is valid.
ASSERT_VALID(pItem);
// Launch the server to edit the item.
pItem->DoVerb(OLEIVERB_SHOW, this);
// As an arbitrary user interface design, this sets the
// selection to the last item inserted.
m_pSelection = pItem; // set selection to last inserted item
pDoc->UpdateAllViews(NULL);
//Query for the dispatch pointer for the embedded object. In
//this case, this is the Word document.
LPDISPATCH lpDisp;
lpDisp = pItem->GetIDispatch();
//Add text to the first line of the document
_Document doc;
_Document ActiveDoc;
Selection selection;
_Application app;
PageSetup pagesetup;
_Font font;
//set _Document doc to use lpDisp, the IDispatch* of the
//actual document.
doc.AttachDispatch(lpDisp);
//Then get the document's application object reference.
app = doc.GetApplication();
// From there, get a Selection object for the insertion point.
selection = app.GetSelection();
selection.SetText("This is a good place to say \"Hello World\"");
// Automate setting the values for various properties.
font = selection.GetFont();
font.SetName(_T("Tahoma"));
font.SetSize(12);
selection.SetFont(font);
But SaveAs method is not available ......
_Document oActiveDoc;
oActive = app.GetActiveDocument();
oActive.SaveAs(.....................);
--> Exception Error~!!!
|
|
|
|
|
I am trying to build several sample apps that let you use the MS Activex scripting engine in your apps and I get the following linker error with all of them:
ScriptEngineFactory.obj : error LNK2001: unresolved external symbol _IID_IActiveScriptParse
I assume this is quite a basic problem but I haven't been able to work out how to resolve it so far.
For an example of one such app see: Hosting VBScript in your own Application
I've just worked out this is happening on XP, but not on W98.
Any assistance much appreciated.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Hi all.
In my application (MFC), I need to develop a network White Board that will be able to open and share MS Office documents.
I didn't find any other way to open and use a Powerpoint document but to use Automation. I do not want (and it is not possible anyway) to install Office on any of the machine the software will run on. I found Powerpoint Viewer and derived the classes from Msppt8vr.olb (using ClassWizard) to be included in my application. I would prefer to be able to read the Powerpoint file format instead of using Automation, but it looks like I have no other choice unless MS decide to release the specs of their format or (and this is what I hope) someone already managed to read and work with this format.
Anyhow. After spending days looking for infos over the web (most of the MS documentation is for VB) I found the right way to use Automation for Powerpoint Viewer (which is different than Powerpoint). But still, when I create the object through OLE Automation, the CreateDispatch function failed and I have no clue why. Here's my code:
[CODE]
void CCtipptDlg::OnButtonPpttest()
{
_Application app;
SlideShowView ctippt;
COleException e;
CLSID clsid;
// Create the object that we'll drive through OLE automation.
if (CLSIDFromProgID(OLESTR("PowerPointViewer.Application"), &clsid) != NOERROR)
{
AfxMessageBox("CLSIDFromProgID Error!");
return;
}
if (!app.CreateDispatch(clsid, &e))
{
AfxMessageBox("CreateDispatch Error!");
return;
}
}
[/CODE]
The first IF statement (CLSIDFromProgID) returns with no errors, meaning that it's finding the CLSID just fine in the MS registry (I also doubled checked manually in the registry and its fine).
But the second IF statement (CreateDispatch) fails and the thing doesn't create the object!
If anyone has a clue about why it doesn't work, let me know.
Thanks a lot in advance, guys...
|
|
|
|
|
You might want to start off by looking at e.m_strDescription, which should contain a description of what is going wrong. Of course it'll likely be something like "Error 123xyz: Method Failed"
Pete
|
|
|
|