|
i want to use my program to replace the windows logon dialog box on windows 98/nt/2000,who can tell me what should i do,especally on 98;P
|
|
|
|
|
Hi
I need to call a dos command in my program, which is a win32 console application. Does anyone know how?
Thanks
kk9
|
|
|
|
|
Try system("dir"); or system("command /k dir "); (or cmd for NT). The /k switch leaves the user at the command prompt until they type exit to return to your prog, so this acts as a sort of 'shell to DOS' command.
|
|
|
|
|
If I understand you correctly you wish to call a DOS command from your program without suspending the running of it or forcing a Command Prompt to appear for the running of any commands. If this is correct, you need to call the system function.
int system( const char *command );
Only problem with this is the fact it can only return an int to tell you if it worked or not and also any error that occurred via errno. If you wish to get access to the response of the DOS command you would I suppose have to pipe the DOS command to a file ie. [nRetVal = system("dir C:\Program Files > C:\Output1.txt")] and then parse the results from the file later in your program.
Hope this helps.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Question Summary: How do you customize the "tooltips" displayed by Intellisense?
Question Details:
I am trying to customize the "tooltips" that show up as a part of Microsoft's Intellisense "Auto Complete" feature.
For example, while building an ASP page in Visual InterDev, if I type "Request" and a dot (.), an Intellisense window "pops" up and displays the properties and methods that the ASP Request object supports. As I scroll down the list of available methods and properties, an "information" tooltip appears to the right of the drop down list.
I have been able to trace the content of these "information" tooltips back to the type library ASP.tlb. The same "information" string appears in the helpstring attribute. It would seem that this is the source of the text that Intellisense uses. (If this observation is incorrect, please let me know)
When I created a test component, I put my own detailed help "information" string in the helpstring attribute. However, when I do this it does not show up like it does for Microsoft's intrinsic ASP objects. In fact, it does not show up at all.
What am I doing wrong? Why is Microsoft able to do this and I am not? Is there a different IDL attribute to set, or perhaps a different IDL compiler is required?
Thanks in advance for any advice or recommendations. If anyone knows of good documentation of Microsoft's Intellisense, that would be great too.
Sincerely,
Trong Ha
|
|
|
|
|
I only have experience with C++ so I do not know if this would apply to ASP...
Intellisense uses comments located around the source code. E.g.
class Foo
{
// Method description
int Func();
int _value; // Variable description
};
void main()
{
Foo f;
f.// Intellisense pops up now
}
Once the period is typed Intellisense comes up. When you highlight "Func" it will display "Method description" from the comment above the method declaration (it removes the //). Same thing for a variable. If it doesn't find a comment above the declaration it looks after it.
I have noticed sometimes it works right after I #include the file; sometimes it will not work until a close and re-open the project. I've also noticed that it does not always work with COM interfaces.
I don't know if any of this relates to ASP but I thought I would share my experience with Intellisense in case it does.
|
|
|
|
|
I'm doing a programatic install of device drivers in NT, but before I do it, I would like to make sure the user has permissions to do so (and fail gracefully if they don't).
I'm looking at NetUserGetInfo() but it doesn't appear to be behaving as expected.
Some additional details:
Look up rights from the local machine first
look up rights from the domain controller (of the primary domain)
If they have admin rights, groovy. If not, die (which I can do )
Does anyone have some sample code that I can use?
Thanks!!
--Dave Weber
|
|
|
|
|
Found this in "Taking Object Ownership" in the MSDN:
HANDLE hToken;
if (!OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES, &hToken) {
printf("OpenProcessToken failed: %u\n", GetLastError() );
return FALSE;
}
if (! SetPrivilege(hToken, SE_TAKE_OWNERSHIP_NAME, TRUE) ) {
printf("You must be logged on as Administrator\n");
return FALSE;
}
Might be other ways, but this seems kind of short and sweet
|
|
|
|
|
It works! Thanks!
It's not short though. You have to define SetPrivilege(...)
It's in MSDN "Taking Object Ownership"
BOOL SetPrivilege(
HANDLE hToken, // access token handle
LPCTSTR lpszPrivilege, // name of privilege to enable/disable
BOOL bEnablePrivilege // to enable or disable privilege
)
{
TOKEN_PRIVILEGES tp;
LUID luid;
if ( !LookupPrivilegeValue(
NULL, // lookup privilege on local system
lpszPrivilege, // privilege to lookup
&luid ) )
{ // receives LUID of privilege
printf("LookupPrivilegeValue error: %u\n", GetLastError() );
return FALSE;
}
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
if (bEnablePrivilege)
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
else
tp.Privileges[0].Attributes = 0;
// Enable the privilege or disable all privileges.
AdjustTokenPrivileges(
hToken,
FALSE,
&tp,
sizeof(TOKEN_PRIVILEGES),
(PTOKEN_PRIVILEGES) NULL,
(PDWORD) NULL);
// Call GetLastError to determine whether the function succeeded.
if (GetLastError() != ERROR_SUCCESS)
{
printf("AdjustTokenPrivileges failed: %u\n", GetLastError() );
return FALSE;
}
return TRUE;
}
It's a common enough thing to have to do. I'm sure there must be some built in function somewhere.
|
|
|
|
|
I am having trouble recasting a void pointer - can someone please help me.
My code looks like this:
void* structure = NULL;
...
structure = (CWPSTRUCT*) lParam;
hwnd = structure->hwnd;
when I compile, I get this error:
error C2227: left of '->hwnd' must point to class/struct/union
I am a bit confused as CWPSTRUCT is a structure and the error is not generated on the line where the casting is done.
Thanks,
Andrew
Andrew Traub
CompuFlash, Inc.
http://www.compuflash.com
|
|
|
|
|
You need to do this:
CWPSTRUCT * structure = NULL;
...
structure = reinterpret_cast<CWPSTRUCT *>(lparam);
hwnd = structure->hwnd;
The problem was that you told the compiler that structure was a void pointer, not a pointer to CWPSTRUCT, when you declared it.
He was allying himself to science, for what was science but the absence of prejudice backed by the presence of money? --- Henry James, The Golden Bowl
|
|
|
|
|
I havent programmed so much before, and I wonder how I can switch between two forms in a window. I am using visual c++ 6.0. My goal is that when I push a button one form is going to appear, and when I push annother button the other form is appearing. If anyone can help me I would be grateful.
|
|
|
|
|
Hi
I would like to grey out an item in the Tree of Outbarcontrol.
Pl let me know how to proceed.
Karthik
|
|
|
|
|
I created a small browser with Internet Explorer Component, and i'd like to use proxy like IE do, but i don't know how??
Help!!
|
|
|
|
|
I try to write an application what is using the CHTMLView. That is quite simple. Next I wanted to implement that I get informed about when somebody clicks on a link, so I can react on it by something else than browsing to the
destination, i.e. to call another functions in this application.
In general it works using the CHtmlView::OnBeforeNavigate2 function. I can hook into this call, can do something else and can prevent that the browser tries to open the link, but later I get an error message that i havn't handy now.
So my question would be: Am I using the right approach, or am I absolutely wrong? Does somebody have a sample on this?
Thanx in advance,
--
regards Matthias
|
|
|
|
|
Am I using the right approach, or am I absolutely wrong?
Sounds good to me. This is the way I do it.
OnBeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers, BOOL FAR* Cancel) <br />
{<br />
char pmbbuf[MAX_PATH];<br />
strcpy(pmbbuf, (char*)(_bstr_t)URL->bstrVal);<br />
<br />
if(pmbbuf == the_link_i'm_overriding)<br />
{<br />
DoSomething();<br />
*Cancel = TRUE;<br />
}<br />
}
|
|
|
|
|
I'm writing an application that try to spy IE's HTTP requests.
I want to get the headers and the respons headers.
But OnBeforeNavigate2 gives only additional headers and
there is no way to get respons headers at all.
How can i do that?
I think about getting the IPersist object of IE
and then somehow add notification, but don't know
how this can be done or if it worth trying.
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
i need help !!
i have a check box who i checked the push button properite .
the Question IS how i put bitmap on the push button when the button ON
and another bitmap(picuter) When the button is OFF?!
(Change the bitmap with check box status)
Ron
|
|
|
|
|
Look at CBitmapButton - it allows you to set a bitmap for pressed, not pressed, focus off and a fourth state that I can't remember !!!!
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi there,
Well I have a strange problem.
I'm Using Access 2000 DB and i'm connected through ODBC Drivers in MFC using CRecordset.
I have a Table with a field of type Date/Time in Access 2000 DB , which the CRecordset uses :
RFX_Date(pFX, _T("[FirstInstallDate]"), m_FirstInstallDate);
(to exchange data between the Recordset itself and the Database.)
all i do before this is :
rsRecSet.m_FirstInstallDate = CTime::GetCurrentTime();
and the definition is :
CTime m_FirstInstallDate;
Everytime i get to this line i have a notification in DEBUG MODE :
Microsoft Visual C++ : Unhandled exception in MyApp.exe (MFC42D.DLL): 0xC0000005: Access Violation.
and the App. is stuck and i can't go on .... but the record is written and in a right way ... ????
and when i run the same App. in RELEASE MODE it Closes with Abotion Message.
Does somone have any idea ????
Thanks alot,
Ariel.
|
|
|
|
|
Hi.
How could I simply send an e-mail message in a VISUAL C++ application ?
Do I have to use MAPI ?
Thanks.
|
|
|
|
|
there are 2 classes on codeproject by pj naughter ... one for smtp and one for mapi ... both work well ... search for articles by him
rock on pj
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
in an MDI or SDI in BEGIN_AFX_MESSAGE jus add this two lines and set the ID of the following menu button
ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
BLaZe
|
|
|
|
|
Okay, I've finally found a reason to use COM for something.
I wrote a (regular) DLL using VC++ 6.0 to perform a task - reading an HTML file, parsing out the tags, and making the data available to the calling executable. This DLL uses MFC (CString, CFile, and the CxxxxArray classes) to aid in this task. When using this DLL from another C++ program, it works fine because the parameters being passed between the executable and the DLL are of type char*. Writing it as a regular DLL also provided easier/faster debugging of the core code within the DLL. Convinced that it worked as intended, I moved on.
I wrote the code so that people could write programs in other languages that use my code. After thinking about leaving it as a DLL and letting other folks worry about how to use it, I decided I'd go ahead and turn it into a COM object.
I wrote the ATL com object (using a simple ATL interface object) and it compiles just fine. However, I don't see a way to add it automagically to my application. I looked through Project|Add to Project|Components & Controls, but the com object I wrote doesn't show up anywhere.
Next, I tried creating an ATL COM object using an ActiveX interface object, and I still can't find the resulting ATL COM object with the tools provided by MS.
I even tried browsing to the DLL that contains the DLL and Visual Studio tells me the component is not a recognizable component.
What am I doing wrong?
|
|
|
|
|
you can always just add a line like this to your stdafx.h:
#import "myAtlThing.tlb" no_namespace
this will create .TLI and .TLH files in your debug directories. these are "smart pointer" wrappers for your ATL objects.
usage is easy. if your object is named "MyATLObject"
MyATLObjectPtr atlobj;
HRESULT hr = atlobj.CreateInstance("MyATLServer.MyATLObject");
if (!SUCCEEDED(hr))
{
AfxMessageBox("Create failed");
return FALSE;
}
...
it's not as nice as the MFC wrapper, but it works OK.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|