|
Edit : Issue was mostly with the spawned EXE that did not handled parameters properly.
Now everything is working ok.
Thanks.
I'm trying to figure out a couple of issues I have with some path that contains spaces when using ShellExecuteEx :
The current directory contains space : C:\Users\me\Documents\Visual Studio 2008\Projects\asdcasd\asdcasd
TCHAR Buffer[MAX_PATH];
DWORD dwRet;
dwRet = GetCurrentDirectory(MAX_PATH, Buffer);
CString sWorkingPath;
sWorkingPath.Format( _T("\"%s\""), Buffer );
CString command ( _T("XMLtoPDF.exe"));
CString parameters( _T(""));
CString sExe;
sExe.Format ( _T("\"%s\\%s\""), Buffer, command);
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = _T("open");
ShExecInfo.lpFile = sExe;
ShExecInfo.lpParameters = parameters;
ShExecInfo.lpDirectory = sWorkingPath;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
The exe spawns a console (it's a perl byte-compiled stand-alone) and tells me the path is not good : C:\Users\me\Documents\Visual does not exists.
I've checked the path and they all semms to be double-quoted to handle the spaces.
Am i missing something ?
Thanks a bunch.
Watched code never compiles.
modified on Thursday, July 8, 2010 3:52 PM
|
|
|
|
|
Suggestions:
1) Use GetShortPathName() .
2) Use UrlEscape() .
I'm not sure if either will work, however.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I have a CFormView class that hosts a Microsoft WebBrowser ActiveX control. I use the control to browse to various HTML pages. Some of these pages create pop-up pages, through some JavaScript buttons.
Now when I browse to the site through IE, and the pop-up windows are created, they work fine and display their contents. When I browse to the site through my app, the pop-up windows are created, but I get a script error saying "A security error has occurred". I can then continue by clicking on the "Yes" button, but nothing further happens.
In my application I browse to the pages through Navigate2("http://username:password@site.blah"), thus passing some security credentials to the page. Could this be the problem ? How do I pass these credentials on to the popup (of which I have no control) ? Any other ideas as to what the problem could be ?
Thanks !
OD
|
|
|
|
|
On accessing a class member variable, the process crashes.
The class variable is a structure instance of size 108 bytes which is properly padded.
On Get_proc() which returns the structure pointer(address of the instance) it crashes.
The Get_proc() is called from another class scope.
The Stack points within the Get_proc() call and then accessing the structure address it crashes. The structure pointer is not NULL.
On making the structure instance scope as global, it does not crash.
Please do give your inputs.
user_m is a properly padded aligned structure with variables BYTE and WORD.
class User
{
private:
user_m inst_user_m;
public:
user_m* Get_proc();
}
user_m* Get_proc()
{
if (&user_m)
return &user_m;
}
|
|
|
|
|
apphia_j_79 wrote: if (&user_m)
Since inst_user_m is not a pointer, this really makes no sense.
apphia_j_79 wrote: return &user_m;
Shouldn't you be returning &inst_user_m instead?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Does the instance of User you call Get_proc() on exist after the call to Get_proc()?
If you do something like:
user_m *grab_user_m()
{
User u;
return u.Get_proc();
}
then you're on a one way trip to stack overwrite city. From your symptoms this would be the first thing I'd look for.
Just remember: NEVER return pointers or references to lumps of data internal to a class - it'll all end in tears unless you're very careful.
Cheers,
Ash
|
|
|
|
|
Greetings,
Before I start tearing my hair out I wondered if anyone might be able to help.
Thus far I have no problem in using OLEDB with SQL Compact via an accessor BUT I simply cannot find out what native data type to map a 'bit' value to.
At present I have the following which compiles fine.
class CDBMain
{
public:
BOOL f_HubDel;
...
BEGIN_COLUMN_MAP(CDBMain)
COLUMN_ENTRY(1, f_HubDel)
...
However at runtime I have binding errors like this.
Binding entry 0 failed. Status: 2
Now I am about to rework the SQL DB schema to use a CHAR[1] but if anyone can tell me what I am doing wrong then you will save me a lot of work.
Many thanks
Alan
|
|
|
|
|
Just a guess here but did you try with bool (lowercase bool, not BOOL)? Or maybe with a bitfield type, like:
int f_HubDel:1; or unsigned int f_HubDel:1; ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Sorry but that does not work either.
Since I posted I have been doing some digging and I found the following in atldbcli.h
DEFINE_OLEDB_TYPE_FUNCTION(SHORT ,DBTYPE_I2)
So you would think SHORT would do... Nope that fails to bind too.
I have found two solutions
1. Update atldbcli.h to include your own DEFINE_OLEDB_TYPE_FUNCTION for DBTYPE_BOOL
2. Use a CAST in the SQL command to convert the value to an int as follows.
CAST(Table.BitField AS int) AS AltName
Personally I have decided to stick to the latter.
I hope this will save someone the pain I have just been through.
Alan
|
|
|
|
|
Hi all..
I am trying to make a small exe in VC++ that shows system turn on time and the number of hours elapsed till shutdown.. can someone help to figure the method in vc++ .. I have a similar exe of VB which is working fine... Plz help me ...
Thanks in advance...
|
|
|
|
|
This[^] might help.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Thanku so much for the help.. i made it work in my exe... working fine..
One more help how do we find the time of boot up of our system..
thanks again
|
|
|
|
|
What exactly do you mean by "time of bootup"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
i mean, how can i display the exact time i turned on my PC..
thanks for ur quick response...
|
|
|
|
|
I supose you could try using GetTickCount[^] and then subtract this from the current system/local time to get the time the system was started.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Code-o-mat wrote: I supose you could try using GetTickCount...
Unless the system has been up for longer than 49.7 days.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
True, but what can he do to avoid this problem? Is there some api call that gives him the exact time the computer was switched on even if it happened 2 days ago or somesuch?
I guess he oould check windows's uptime, and if that is longer than what he gets out of GetTickCount then he can calulate how many times that might have overflown to correct the value.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
sonualex wrote: One more help how do we find the time of boot up of our system..
Look at the Win32_OperatingSystem WMI class, specifically the LastBootUpTime member.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi I ahve created a Listbox using myclass which is derived from Clistbox. I want to set the Mouseover effect on the listbox, I mean whenever my mouse moves from one index to other it should be hilighted.
Can anybode please help me..
Please send me some sample code if possible..
Thanks
|
|
|
|
|
As far as i know CListBox doesn't provide you with this feature. You can however try implement it yourself , you would probably need to use an owner drawn list box for this by adding the LBS_OWNERDRAWFIXED style, handle the WM_MOUSEMOVE message, use TrackMouseEvent[^], the ItemFromPoint[^] method.
p.s: CListCtrl however does have an extended style called LVS_EX_TRACKSELECT that probably does what you want, if possible you might try to use CListCtrl instead of CListBox.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I am trying with the below function, but every time its drawing the 1st item only..
basically the GetItemRect() needs the index value as the first parameter, can u please tell how to get the index value of the list box when mouse is moving from one item to other.
my code is like this :
void CTxListControl::OnMouseHover(UINT nFlags, CPoint point)
{
CDC* pDC = GetWindowDC();
CRect rect;
GetItemRect(0,rect);
rect.OffsetRect( -rect.left, -rect.top);
CBrush brush( RGB(0, 0, 255));
pDC->FillRect(rect, &brush);
}
|
|
|
|
|
See ItemFromPoint[^], as i already wrote.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
We know that in a 32 bit system a 4 gb memory gets allocated to a process.
So how much maximum memory can be allocated using a malloc function call?
|
|
|
|
|
That depends on what OS you will be using.
|
|
|
|
|
Thanks Niklas for the inputs
If suppose I am using a 32 bit windows or linux OS then what will be the limit?
|
|
|
|