|
Christian Graus wrote:
I think I didn't make my deadline, but the article is up.
Well, it's a good thing that we're not at school and I'm not your teacher
I read the article and now I'll go through the code. The article seemed very useful, not only for this case, but also for the future. Thank you once again!
-Janetta
|
|
|
|
|
To redirect printf is not that easy. I tried it the time I was writing the article
CEditLog - fast logging into an edit control with cout (which should also be quite useful to you), but failed. The internal structure of CRT streams (FILE*) is undocumented and to get it out of the sources is quite a long way.
However, If you have all sources available, the solution could be quite easy:
1) Write a printf-compatible function that prints out the output into the edit:
int printf_edit( const char* pszFormat, ... )
{
...
}
2) Add the following definitions to your stdafx.h (or in front of every .cpp file):
#undef printf
#define printf printf_edit
and recompile the whole thing.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Your article was very useful! I think I'm able to solve the problem now.
Thanks!
-Janetta
|
|
|
|
|
Console is application , but application can create windows (:
there are ( on this site ) some exapmles, how to create windows from console (:
----------------------------
my eng is bad, so am i .. (:
|
|
|
|
|
I want to program a simple spreadsheet program, where can I find any resource, like source code and data format. Especially the format, what are the basic elements should a spreadsheet file contains?
|
|
|
|
|
Stingray offer a product which is essentially MS Excel 2000. You get the source code and can compile to lib or ctrl.
Alternative you need to start of with a Grid Clickerty and you'll need a parse and expression engine and if you want to support VB script you'll need a VB Scripting engine.
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
I have a ISAPI extension, which I suppose run in security account
of IUSR_MACHINENAME. For accessing a database located on
another server, I must change the user to an account which has rights in database.
Is this possible? I know is possible to "create a process as user"
but I don't know about changing the user during process running.
If I'm on a wrong way of thinking, which are the possibilities?
Regards,
Don
|
|
|
|
|
It is not possible to change the security context of a running process. However, you could use impersonation to change the context of your current thread, which is actually what you want to do
For this you have to get a proper impersonation token from somewhere. You can get such a token via some IPC mechanisms (like NamedPipes, RPC, DCOM) or by calling LogonUser(). However, I doubt that IUSR_MACHINENAME has the necessary privileges to call LogonUser().
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Thanks Daniel,
You give me some good ideeas, with LogonUser(). If IUSR_... has not enough ritghts, I'll include it in Administrators group, and maybe
will work.
The other ideea, to
Daniel Lohmann wrote:
get such a token via some IPC mechanisms
I simply don't understand: from where to request the token?? With who
shall I communicate via IPC?
... and what is this "Impersonation" means???
Thanks again.
|
|
|
|
|
Don Miguel wrote:
You give me some good ideeas, with LogonUser(). If IUSR_... has not enough ritghts, I'll include it in Administrators group, and maybe
will work.
Uh, oh - I would double think about that. It's the sense of special IUSR_xxx accounts that they are low privileged and therefore your Inet apps do open a big security hole. I don't have much knowledge about all this IIS stuff, but maybe you could configure it to run your ISAPI in another user context than IUSR_xxx. That would be much better, because no other extensions are affected.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
I've a COM object in VC++ that has setData(PBYE* pdata, int nsize) function. What's the equivalent of it in IDL, so in VB it can pass the data to the COM.
Moreover, what's the way VB pass the data to it ?
|
|
|
|
|
what is PBYE ? If you want to pass a string into COM it will need to be a BSTR. VB will convert a string literal or value for you, AFAIK.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Sorry, it should be PBYTE (in C++, a pointer to byte). I'm not going to pass String values, I want to pass binary data to an COM object.
|
|
|
|
|
Dear friends, How to get properties of any control ie created by any application (not window styles, extended styles) eg: Delphi.
waiting for reply
Thanks,
Raman.
|
|
|
|
|
I want to make a serial port communication program. I define a STRUCT variable
struct _COMM_PACK
{
char sID[PACK_ID_LEN];
BYTE cCmdCode;
UINT nVerifySum;
int nDataLen;
BYTE cData[MAX_DATA_LEN];
}aSendPack;
and want to send 'aSendPack'in the Mscomm control-comm like:
comm.SetOutput(aSendPack);
but the SetOutput need a VARIANT variable
how can I do that?
thanx!
|
|
|
|
|
! DONT use the MSCOMM control !
If you have to one would...
aSendPack var;
ZeroMemory(&var,sizeof(var));
var.cCmdCode = 0x0100;
etc. etc.....
and finally
comm.SetOutput((char*) &var);
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
Hello,
I am using Installshield for VC++ 6.0 to build a setup program for my program. I was wondering how can I add a shortcut in the startmenu for my programs exe file in the start menu.
Right now .. I am using the follwing code to make the icon in the startmenu
svPath = TARGETDIR ^ "TDMS2000.exe";
LongPathToQuote ( svPath , TRUE );
AddFolderIcon (FOLDER_PROGRAMS^SHELL_OBJECT_FOLDER , "TDMS2000" , svPath , "" , "" , 0 , "" , REPLACE );
But there is a problem with this code. My program needs a .dat file to start that resides in the same directory as the exe file. So when I follow the link created in my start meny using the code above .. the program fails to see that .dat file. When I create a shortcut manually and place it in the start menu .. the program works file.
I will really appreciate any solution to this problem. Thanks!
Sincerely,
Anjum.
|
|
|
|
|
I think the problem is not with the insatalshield but in ur application code..
Ur reading for sat file may be wrong..(i.e)The path u have given for reading the .dat file is relative with ur exe....So the application is searching is the oath where start menu short cut resides....
U have to explictily give the full path of ur exe dor reading the .dat file..
If u can give the code for reading of .dat file and i can clearly analaysis the problem
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Mani,
Thanks for your response. Yes, I am using a relative path, but I was doing it thinking that since the user may choose to install the my program under any folder, I should give a relative so that it will be able to open the my .dat file as long as they are together in one folder regardless of the folder chosen by the user during installation.
When I manually create a short cut of my EXE file and put it on the desktop or in the start menu .. it reads the .dat file fine. I was thinking that an icon created by the setup program should work the same way.
I am attaching my code. Thanks for looking into it.
<br />
char *pszFileName="config.dat";<br />
char pszIName[256];<br />
CFile myFile;<br />
CFileException fileException;<br />
if ( !myFile.Open( pszFileName, CFile::modeRead, &fileException ))<br />
{<br />
::MessageBox(NULL, "File doesnt exist ","Warning",MB_OK);<br />
<br />
}
Also I have a trivial question. Why do I have to put :: before Messagebox function sometimes to make it work. Sometimes it is works without the dots.
As you can probably see that I do lack some of basic knowledge of MFC.
Thanks for your help!
Sincerely,
Anjum.
|
|
|
|
|
Yeah thats the problem.......
U should nver give the relative path..I will not work...In this code when u run with start menu it will search the folder of startmenu and never the exe..So its better u use Absolute path of exe...
So use this piece of code..
<br />
CString StrLaunched;<br />
TCHAR szFullPath[MAX_PATH];<br />
TCHAR szDir[_MAX_DIR];<br />
TCHAR szDrive[_MAX_DRIVE];<br />
::GetModuleFileName(NULL,szFullPath,MAX_PATH);<br />
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);<br />
StrLaunched.Format(_T("%s%s"), szDrive, szDir);<br />
char *pszFileName=StrLaunched+"config.dat";<br />
This will work.....
Then :: means ur calling an Windows Sdk function
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
I can't seem to get the scroll bar of my edit box to display on the left. I've tried using the left scroll bar style but the scroll bar stays on the right. How do I get it to display on the left.
-Raffi
|
|
|
|
|
Scroll bars can be aligned to the left (using the WS_EX_LEFTSCROLLBAR style), but they take effect only in Hebrew and Arabic versions of Windows 95 (and any languages whose characters can be read from the right).
You give no reason for which a left-aligned scroll bar would be beneficial.
Peter O.
|
|
|
|
|
I get the following error when I use DAO with a text file:
<filename> is not a valid file path. ...
Could someone tell me what I am doing wrong?
CString sFile = "c:\\ashish.txt";
CDaoDatabase db;
CDaoRecordset rs;
db.Open(sFile,FALSE,TRUE,"Text;");
.
.
.
Thanks
ashish
|
|
|
|
|
Hello,
The msdn document says the insertion mark is available for windows XP
Visual Styles. But I don't see this the insertion mark present even I have
a manifests in my program. Do you have any idea how to enable it?
Thanks,
Hiusing
|
|
|
|
|