|
If you're looking for all 3 keys to held down at the same time, just look for one of them (like "E") with PreTranslateMessage, then check keystate of others with GetAsyncKeyState. VK_CONTROL is virtkey for Ctrl, and VK_MENU is virtkey for Alt.
|
|
|
|
|
I just starting developing WMI programs on C++ but i have a problem: i can't connect to WMI namespace on remote machine... i want to make programm that will ask user account to connect WMI. I need some working example on C++... Can some one help me, please?
|
|
|
|
|
I have a number of modeless dialog in my MDI applicaion.
When I try to open multiple dialogs and close, sometimes
the application fails. what is the proper way to close a
modeless dialog if I open the dialog like the following.
at the moment I make another function in dialog class called
closedialog and call protected function OnClose() any I was
thinking of deleting the pointer that was new at the top of
line. I am not 100% sure about it.
Any help is appliciated.
if( ! p_MyModelessDlg )
{
p_MyModelessDlg = new CMyModelessDlg;
}
if( pDoc -> b_Data == TRUE )
{
if (!::IsWindow( p_MyModelessDlg -> GetSafeHwnd() ) )
{
p_MyModelessDlg -> Create(IDD_MYMODELESS, this);
}
p_MyModelessDlg -> GetData();
p_MyModelessDlg -> ShowWindow(SW_SHOW);
p_MyModelessDlg -> b_OpenStatus = TRUE;
}
|
|
|
|
|
|
You need to override the beahviour of the PostNcDestroy() - in this method
FIRST call the super classes' PostNcDestroy()
and then
delete this;
You may need some way to tell your app the dialog is closed (you might put this in your PostNcDestroy impl.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
I need to do this in the console, how can you open a file from the program and then go to line_. Then depending on what was on that line output something else. I would appreciate maybe even a website. AI thing ya know.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Using MFC:
CStdioFile file(...);
CString strLine;
int nLine = 17;
while (nLine >= 0 && file.ReadString(strLine) == TRUE)
nLine--;
file.Close();
TRACE("This is the 17th line: %s\n", strLine);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
In my dialog app i am unable to trap
WM_CHAR , WM_KEYUP, WM_KEYDOWN ? I dont know why ? Please help
|
|
|
|
|
I need to disable the tool bar button in my application (MFC).
kindly advise.
note :already tried using CToolBarCtrl::EnableButton().It did not work
|
|
|
|
|
Hi,
You have to use the OnUpdate command for the tool bar button. For example say I had a button called delete in which I had a function called OnDelete().
Updating the toolbar button would work like this:
OnUpdateDelete(CCmdUI* pCmdUI)
{
pCmdUI->Enable(FALSE);
}
That would disable it. Obviously you can pass true or false into the enable function. That's all there is to it.
Mike
|
|
|
|
|
Hello,
I am trying to download files from the internet. Currently I use the Windows API functions InternetOpen, InternetOpenURL, InternetReadFile, etc.
HINTERNET hFile;
DWORD dwRead = 1;
BYTE pHttpBuffer[TR_BUFFER_SIZE];
hFile = InternetOpenUrl(m_hConnection, TR_URL, NULL, 0,
INTERNET_FLAG_RELOAD, 0);
if(hFile == NULL) return false;
while(dwRead != 0)
{
if(InternetReadFile(hFile, pHttpBuffer, TR_BUFFER_SIZE, &dwRead) == TRUE)
{
if(dwRead != 0)
{
_ParseBuffer((char *)pHttpBuffer, TR_BUFFER_SIZE);
}
}
else dwRead = 0;
}
InternetCloseHandle(hFile);
The _ParseBuffer function does something with the buffer, it doesn't matter here.
When I start the program, it sends out some bytes (I see this with personal firewall monitor) and waits about 10 seconds for the answer. I don't know what I am doing wrong. It's not the internet server.
Do you know any other method than this for downloading files? I cannot use URLDownloadToFile, nor can I use MFC.
Thanks in advance
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hi all and sorry for my English,
I writed this code very time ago.
bool InetStartup()
{
g_hInternet = InternetOpen( INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
NULL,
0 );
HINTERNET hSession;
DWORD dwContext = 0;
hSession = InternetOpenUrl( g_hInternet,
_T("http://www.stratos-ad.com/gfx/home_top_01.gif"),
NULL,
0,
0,
dwContext );
char pBufferData[1024];
DWORD dwBytesRead;
DWORD dwBytesWrite;
HANDLE hFile = CreateFile( _T("Dibujo.gif"),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
NULL );
while( InternetReadFile( hSession,
pBufferData,
1023,
&dwBytesRead ) )
{
pBufferData[dwBytesRead] = 0;
OutputDebugString( pBufferData );
OutputDebugString( _T("\n") );
if( dwBytesRead == 0 ) break;
WriteFile( hFile, pBufferData, dwBytesRead, &dwBytesWrite, NULL );
}
CloseHandle( hFile );
return true;
}
bool InetStop()
{
InternetCloseHandle( g_hInternet );
return true;
}
I hope help you.
Byes
|
|
|
|
|
Yes, I did exactly that. I've tested some sources available here at CodeProject, but all samples have this 10 seconds delay so it seems it isn't my code whats going wrong...
I've solved the problem using the URLDownloadToCacheFile API. Yes, I've written that I don't want to use this function, but do I have another choice?
URLDownloadToCacheFile works perfectly. The file gets downloaded in milliseconds (as it is viewed in the browser), there is no 10 seconds delay.
Though, thanks for your reply
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Has anyone got a sample of a windows service application which interacts with the internet? I need to submit database information to a web based application.
Any documents and/or url's will be most welcome.......
thanks
bart
|
|
|
|
|
I have a Window which creates dinamically some OCX. I have to use the WS_CLIPCHILDREN in order to reduce the flickering, but at same time I would like to force the repainting of the background of some of them.
I tried to add the rectangle to paint calling InvalidateRect() for all the OCX I want to repaint their background but it doesn't work.
What can I do?
Thanks in advance
|
|
|
|
|
Hi, I want to write a wrapper to a function, which has a "..." argument declaration. For example:
void foo(const char* format, ...)
{
printf(format, ??????)// what do I write here?
}
Any ideas? Thanks.
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
You would include stdarg.h and use vprintf to do something like this:
<br />
void foo(const char* format, ...)<br />
{<br />
va_list args;<br />
va_start(args, format);<br />
vprintf(format, args);<br />
va_end(args);<br />
}<br />
|
|
|
|
|
Hi, I am just starting to learn C(++) and therefore the following might be a silly question to you. But maybe your explanations will help me to understand some principles of C++:
As far as I know pointers are declared like char *xyz (with the * bound to the beginning of the variable name). But in the C++/MFC-Help, pointers are mostly declared as CWnd* xyz (the * is following the type/class name).
What is the difference?
Thx a lot
Christian Planckh
|
|
|
|
|
There is no difference. It's just a matter of style. You can put as little or as much whitespace as you want. The following would all be OK:
<br />
char*xyz;<br />
char *xyz;<br />
char* xyz;<br />
char * xyz;<br />
|
|
|
|
|
I have a Dialog app that creates a PropertySheet .
While performing
propertySheet.Create()
I had allowed the windows Style to be -1 as default. In my main Dialog I have a routine where I call a Method of one of the pages in the PropertySheet that does
a CFileDialog.DoModal(). With the above mentioned window style of -1 for the PropertySheet all works fine .
I changed the style of the PrpertySheet in the Create func to be
WS_VISIBLE | WS_CHILD and the call to the CfIleDialog.DoModal() doesnt end (I never see the FileDialog displayed ) . What is going on ? Any clues . Please help
Engineering is the effort !
|
|
|
|
|
Hello all
I wrote a windows service and installed it. I was able to start and stop the service from Control Panel - Administrative tools - Services. But whenever I try it from command line using the following
net start ServiceName
it's failing. The above command say's service started but the service is shown as stopped when I see it in Admnistrative tools - services. Even the task manager is not showing the service in the process list.
Any ideas?
Many thanks for your help,
Hari.
|
|
|
|
|
I'm developing a single document MFC application.
I'd like to know how I can center a CFromView into the client area of th main window.
I've tried CenterWindow method but it doesn't work.
Can someone help me?
Bye and thank you,
Wollet
|
|
|
|
|
Hi all,
I am trying to build my own C++ framework around the win32 API. The purpose of doing this is to learn how things work behind the (sometimes) mysterious scenes of MFC.
My question is the following:
When painting a dialog in VC, you can specify that a control has the WS_TABSTOP style. If you do that, you can also specify the taborder in which the focus will traverse when using the TAB key. In my framework, controls are also created using WS_TABSTOP.
Firstly, in my framework, it seems the tab key has absolutely no effect whatsoever. Is the taborder functionality programmed in MFC somewhere? I couldn't find it, but maybe I am not looking close enough.
Secondly, how can I specify the order in which the focus will traverse? It seems not related to the ID value of the control.
Thirdly, if someone is interested in the code I am using related to answering this question, let me know.
Best regards, Perry
|
|
|
|
|
All these functions are exported from Shlwapi.dll (7/24/2002) as (ASCII: StrRetToBufA, UNICODE: StrRetToBufW etc)
If not included in your version of Shlwapi.h you could consider checking in the latest W32 SDK (note that the standard MSDevStudio files are usually quite out of date).
Quick solution might be to add its declaration yourself in your code.
You would need of course to make sure that the right version of Shlwapi.dll is installed on the target system
|
|
|
|
|
Perry Bruins wrote:
it seems the tab key has absolutely no effect whatsoever.
You need to call IsDialogMessage() in your message loop for the standard keyboard navigation to work.
Perry Bruins wrote:
Secondly, how can I specify the order in which the focus will traverse?
Tab order is the same as the Z-order of the controls. Use SetWindowPos() to change the Z-order.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|