|
toxcct wrote: you have an interview, don't you ?
No I don't have. I just finished reading "Thinking in C++" and about to start a project in C++. So thought of getting some expert advice on those points.
Thanks for you help. It was really helpful.
|
|
|
|
|
1/ I normally do:
int *pInt;
2/ the question you ask is why I never mix those. And if the variable it at all significant, it gets its own line. I use long variable names - thanks to intellitext they're just as easy to type, and a lot easier to read. Only loop vars get bunched together. int i,j,k;
3/ I try to use const on member functions that *shouldn't* modify the state, not whether I think I might do so. It gives me the freedom to change my mind in one direction, and makes it harder to code mistakes in the other.
Iain.
|
|
|
|
|
Perfect ! Thanks for the help Iain.
|
|
|
|
|
|
Can you elaborate? Format what like this?
-Saurabh
|
|
|
|
|
123456789.00
to
123,456,789.00
Just add a comma every 3 digits at the left of the decimal point.
|
|
|
|
|
Here is the correct method for displaying numerics in English_USA.1252
double dMoney = 0123456789.0123456789;
char szOldCppMoney[MAX_PATH] = {0};
char szNewCppMoney[MAX_PATH] = {0};
sprintf(szOldCppMoney,"%2.2f",dMoney);
LCID lc = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
GetNumberFormat(lc,0,szOldCppMoney,NULL,szNewCppMoney,ARRAYSIZE(szNewCppMoney));
Output will be: "123,456,789.00"
Best Wishes,
-David Delaune
|
|
|
|
|
See StrFormatByteSize if you want to use of bytes/kilobytes,...
|
|
|
|
|
I use ShellExecute() to execute some operations on a ".txt" file. But it just executed a few of them and the others returned an Error.
These operations did not work:
-------------------------------------
1- Properties
2- Delete
3- Rename
.
.
.
Any help?
Thank you masters!
|
|
|
|
|
Not all verbs are available to all files and folders.
As the docs state:
"Generally, the actions available from an object's shortcut
menu are available verbs."
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes I know! But the verbs Rename, Delete and Properties are common to all objectes. Aren't they?
|
|
|
|
|
if you want to delete/rename a file, why don't you use the dedicated API ?
|
|
|
|
|
I poked around my registry and tried a bunch of right-clicks
on files of different types...I couldn't find any type that supported
any of those.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The next question is about catching all the SETTEXT message that are sent to a specific window:
I'm trying to hook all the settext messages that are sent to a specific window. The hook works almost perfectly, it intercepts all the settext messages and gets de windows handle stored in the pwp structure. pwp is a CWPRETSTRUCT type structure that contains the information of the SETTEXT hooked message.
The problem is that I can't get the text(caption) send to the window stored in the LPARAM of the settext hooked message (pwp->lParam. I only get garbage).
The idea is to get the text send to the window and save it to a file.
Im using a CallWndRetProc hook.
Here is my code.
LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
{
TCHAR *a;
FILE *f1;
if(nCode < 0)
{
return CallNextHookEx(hook, nCode, wParam, lParam);
}
if (nCode == HC_ACTION)
{
CWPRETSTRUCT* pwp = (CWPRETSTRUCT*)lParam;
UINT message = pwp->message;
if (message == WM_SETTEXT)
{
unsigned int whandle = (unsigned int) pwp->hwnd;
// globalvar contains the
// (unsigned int)window's handle I want to catch.
if (whandle == globalvar)
{
LPARAM l = pwp->lParam;
// The problem is on the next line.
// Var a only gets garbage.
a = (TCHAR *) l
f1=fopen("c:\\hook.txt","a+");
fprintf(f1,"%d %s\n", whandle, a);
fclose(f1);
}
}
}
return CallNextHookEx(hook, nCode, wParam, lParam);
}
Ignacio Rivera
Mexico
|
|
|
|
|
Could it be possible that the WM_SETTEXT you get has been "POSTED" and the buffer lParam contains a pointer at has been destroyed by the time you get the hook-call?
AtomAnt
|
|
|
|
|
Hey Friends
I need to start an SDI Application (CFormView Based) Hidden
I do not want it to display main window first & then i cann showwindow(sw_hide)
In VC++ 6.0
I could do
....
AddDocTemplate(pDocTemplate);
m_nCmdShow =SW_HIDE;
...
but now in VS 2008
it does not works
Any clue?
|
|
|
|
|
Don't use the WS_VISIBLE style when creating the window?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks
will try
it is a single document interface type application
so will try with CMainFrame & CMyFormView
|
|
|
|
|
I need to compress a file programmatically without using any third party APPs but pure Win32/64 API or plain "C/C++". any one can help me?
Thank you masters!
|
|
|
|
|
Does this page [^] help?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
No! Because it has not introduced any function or algorithm, moreover I think it's only about NTFS!
Any way! Thank you my master, CPallini
|
|
|
|
|
Jusef Marzbany wrote: No! Because it has not introduced any function or algorithm,
please elaborate.
Jusef Marzbany wrote: I think it's only about NTFS!
The requirements, from the documentation page I posted.
Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
<pre>
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
|
Thank you very much Saurabh.Garg. Those are the exact things I needed.
Thank you just the same.
Thank you masters!
|
|
|
|