|
My question is, if it's possible to change the style (dwStyle) and the extended style (dwExStyle) of a created window.
I am working on a window that is a normal OVERLAPPEDWINDOW but when I switch to fullscreen it should be a POPUP etc.
Do I have to Destroy and create a new window?
Thanks!
Constantin
|
|
|
|
|
Did you try ModifyStyle() and ModifyStyleEx()?
|
|
|
|
|
Oh! you see I am not very used to MFC and didn't find it myself
Guess that's what I searched. I'll try it...
Thanks!
Constantin
|
|
|
|
|
The following code is from an artical on "Catching the 'Enter'
Key in windows and controls" by Randy More.
UINT SMUPPGrid::OnGetDlgCode()
{
UINT result = CListCtrl::OnGetDlgCode();
result = result | DLGC_WANTALLKEYS;
return result;
}
The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible.
What would it take to make this function accessible?
Bob Broadway
bob.broadway@att.net
|
|
|
|
|
well,
look for the header file and move the method to the public part.
Probably you have to go up the whole 'pedigree'.
Derive a class from that class you want the function and in that class you have access to the protected function.
First method is to handle with care, second method sometimes is just kind of overkill.
Regards
G.Steudtel
|
|
|
|
|
|
here it is, a piece of code that i cant get to work.
is there anyone that can spend 5 min with this and tell what is not correct?
http://www.xwega.com/toolbartest.exe[^]
this is a simple sdi app made with the wiz.
i have only added the menu "test" and the toolbar buttons
I have created the menu event handlers
the problem is that the menuitem "Ball" can be disable but the button "ball" with the same id is allways enable.
there is code to enable and disable the menu and toolbar button on the menu event handlers.
what is incorrect?
MSN:maxsnts@hotmail.com
|
|
|
|
|
|
|
if the menu item ID and the toolbar have the same ID, they should behave the same, and get enabled, disabled with the same ON_UPDATE_COMMAND_UI handler.
Also, if you didn't define a command handler ( if the menu and toolbar button have no callback ) the menu item will not be enabled, unless there's a ON_UPDATE_COMMAND_UI handler.
show us the code so we can help.
I will not run the .exe ...
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
|
Hi,
I have to use a timer to perform some tasks at specific intervals. The timer needs to be very accurate (+- 10 ms) and use as less CPU as possible. So I decided to use a queue timer, which seems to be the better choice.
In fact, I have to trigger many events at different intervals. For exemple, I have to do something each 30 ms, another task each 120 ms and another one each 350 ms (between 1 to 25 events to trigger). What I'd like to know is which is the best solution :
- using only one timer that calls only one callback procedure each 10 ms for exemple and in this procedure increments variables to know which task to process
- or set up one timer with one callback procedure for each task I'd like to perform. (so it's as if I defined 25 timers but with intervalls of 30 ms, 120 ms, 350 ms ...)
Thanks...
Edouard
|
|
|
|
|
In our experience it is far better to make different timers. Pls note that queue timer do not seem to have much accuracy, better are multimedia timers (timeSetTimer) or waitable timers (CreateWaitableTimer).
Regards,
andrea;P
|
|
|
|
|
I have not designed an application that processes data in a time interval of unver 1000 ms. a time queue timer is one solution for For processs that work in the 500+ ms range. For anything shorter, I recommend a separate worker thread and WaitForSingleObject().
Kuphryn
|
|
|
|
|
A student of mine doing a project needs to send some characters to an open window (i.e. from one running application to another). If I remember correctly this was done using a function called sendkeys in VBasic but not being a VC++ speaker I have no idea how it is done and nor does she.
If anyone can help, she'd be very grateful.
|
|
|
|
|
Use SendMessage(WM_KEYDOWN, ???, 0) for virtual keys or SendMessage(WM_CHAR, ???, 0) for others.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
How to assign to window HELP id ?
I create Window as folows :
//CFrameWnd m_pFrame_RT;
hr = m_pFrame_RT->
//pFrameWnd->
CreateEx(
NULL|WS_EX_CLIENTEDGE ,//WS_CHILD |WS_BORDER
NULL,
(LPCTSTR)Title//"TREND Browser (General)"
,WS_VISIBLE |WS_CAPTION|WS_POPUP|//|WS_OVERLAPPED
//|WS_SIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME
WS_SYSMENU| WS_THICKFRAME| WS_MINIMIZEBOX| WS_MAXIMIZEBOX
//|WS_OVERLAPPEDWINDOW
,0,0,800,600,
g_pMainFrame->m_hWnd,
pMenu->GetSafeHmenu()// IDR_MENU1//
,0);//
if(m_pFrame_RT)
m_pFrame_RT->SetWindowContextHelpId(IDD_WND_HISTORY_WINDOW); // not works
thanks
|
|
|
|
|
Hello
I need your help, to read The source(tags) file of document HTML with visual c++.
Marco Javier
|
|
|
|
|
Are you referring to file editing or socket programming?
Kuphryn
|
|
|
|
|
i need to do a program wich modifies a winXP registry entry and XP security won't let me.
My code will read a registry a key , save it, and make a different key where to load the saved key. The RegLoadKey function call fails with error acces denied. I did set the "SeBackupPrivilege" and "SeRestorePrivilege" so the calling process should have all the security acces needed and the file is ok. But it still doesn't work.
Can you tell me what flag do i need to set in the acces token so i can load/save registry keys? MSDN says it's SE_BACKUP_NAME but it's not enough.
Could the error be in the file security descriptor? I would be strange since the file is created by RegSaveKey.
The MSDN link for Registry functions is
windows Development -> Windows base Services -> Windows System Information ->
SDK Doc -> Registry
Any ideas , suggestions to what it could be?
Thanks
|
|
|
|
|
Hello Everybody,
I have created an AVI Player using DirectShow. This player is working fine. I have also created a View Window (with class name CViewWnd) using CFrameWnd class. This view
window is used in an application which plays its own customised files (of some other extensions) on this view window. Now:
1. I have to play the AVI file on this view window (i.e. integrate my AVIPlayer as a plugin to the original application). To achieve this I am passing CViewWnd instance to AVIPlayer (so
that I will get the cordinates and size of original view window and my AVI player window will overlap the view window. AVI window will be of same size and dimension as of view
window). But it gives error (read point 2 below).
2. Can I pass the instance of my View Window class in AVI Player. If so how? Here condition is that AVI player needs to be a seperate entity i.e. it does not understand my view
window class, neither I can include the view window header in AVI player. If I pass view window as parameter to my AVIPlayer (as HWND *CViewWnd), it gives following error:
((Can not convert parameter from 'class CViewWnd' to 'struct HWND'. Types pointed are unrelated. Conversion requires reinterpret_cast, C-style cast or function-style cats.))
Pls tell me, how my AVIPlayer can understand this CViewWnd class.
Following statement in my AVIPlayer uses the CViewWnd:
pVideoWindow->put_Owner((OAHWND)pViewWnd);
Here 'pVideoWindow' is DirectShow interface and 'pViewWnd' is CViewWnd instance.
1. My original application AVI Player as AVIPlayer is a plugin to the application. So original application does not understand DirectShow.
2. AVI Player does not understand my original application.
So we have to use some MFC standard data type to be passed into my AVI Player.
Thanx in advance for the help.
Regards,
Saurabh Agarwal,
New Delhi, India
(saurabha@momentum-tech.com)
|
|
|
|
|
hey cpians
i need some suggestions / tips on diagnosing a problem w/ one of my
programs / operating environment...
Heres is the data i have to go by so far.
I have a c++ program , which loops forever.
It looks in a particular folder every 30 seconds looking for new files,
that it reads what its found, and processes the info for my needs, than deletes the file.
The program is running on a windows 2000 box.
The problem I am having is that the process just disappears on heavy usage.
No errors , or exceptions that I could try to throw for further data collection, the programs process just disappears and the program stops running and nothing is mentioned of it to me from windows.
Just dont know really where to start diagnosing / building diagnostic data.
Sometimes it will run fine for 2 days looping the same code 20,000 times, and sometimes it dies after 2 hours.
Its the same code looping over and over, so in theory it would be more of a circumstancial / environmental problem the program is running into, than a code itself problem.
any tips / suggestions on places to collect more diagnostic data , or other things to check would be highly appreciated
thanks,
josh
todo....
:: insert inpirational text here ::
|
|
|
|
|
jDawwg wrote:
The problem I am having is that the process just disappears on heavy usage.
Maybe it is just gone fetching a beer, as everybody is busy and noone is looking its way?
Seriously, does it still appear in the task manager? Is it a service?
How do you wait this 30 seconds?
Simply have it touch some file somewhere in every iteration, so you can at least see on the access time when your process has died.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I'm using Sleep() to make it wait. I used the term '30 seconds' loosely before, as you can see in my code posted below I dont quite wait that long even
It doesnt still appear in task manager, it just disappears from everywhere nice and sneaky and strange like! Its not a service.
I know I could build data by coding some logging / RT- data analysis into the program , and then use process of elimination to narraw the problem down between the program or o/s / environment conditions, which I guess seems to be one of my few remaining options so I may bite the bullet and do it this way, i was just hoping i was doing it the hard way or something
#include "stdafx.h"
#include "FileInfo.h"
#include <iostream.h>
#include <fstream.h>
int __cdecl main(int argc, char* argv[])
{
CString s;
char c1[6000]; // Text
char c2[255]; // Storage
char cSpoolFile[300];
char cOutFile[300];
char cOutFileTwo[300];
char cIgnoreList[21000];
char testhold[21000];
char c4[]="blah\0"; // key
int len; //
int result;
int numread;
int sorted = 0;
FILE *input;
fstream outfile;
// read in configuration
ifstream inStream("config.txt");
inStream.getline(cSpoolFile, 300, '\n');
inStream.getline(cOutFile, 300, '\n');
inStream.getline(cOutFileTwo, 300, '\n');
inStream.close();
// read ignore
ifstream inStreamtwo("ignore.txt");
while (!inStreamtwo.eof()) {
inStreamtwo.getline(testhold, 21000, '\n');
s += testhold;
if (!inStreamtwo.eof()) { s += "|"; }
}
inStreamtwo.close();
// null terminate
s += "\0";
// make string to char for var passed into .dll
strcpy(cIgnoreList, s);
// notification...
printf ("Starting Loop.....\n\n");
// loop forever here
while (1) {
// Open directory for read
CFileInfoArray fia;
fia.AddDir(
cSpoolFile, // Directory
"*.*", // Filemask (all files)
FALSE, // Recurse subdirs
CFileInfoArray::AP_SORTBYNAME | CFileInfoArray::AP_SORTASCENDING, // Sort by name and ascending
FALSE // Do not add array entries for directories (only for files)
);
/// here will start the directory iteration
for (int ji=0;ji<fia.GetSize();ji++) {
// read file
if ( (input = fopen( fia[ji].GetFilePath(), "r" ) ) == NULL )
{
//printf( "Could not open file.......%s\n", fia[ji].GetFilePath() );
return 0;
}
// read input , set numread to amount read
numread = fread( c1, sizeof( char ), sizeof(c1), input );
c1[++numread] = '\0'; // null terminate
fclose( input );
// Call the external function with some parameters
result = EXTERNALFUNCTION( *c1, *c2, len, *cIgnoreList, *c4 );
sorted++; // increment the proccessed files count
// act on type returned
switch( result )
{
case PARAM_ONE:
// Open the output file
outfile.open(cOutFile, ios::app);
outfile << c2 << endl;
outfile.close();
break;
case PARAM_TWO:
outfile.open(cOutFileTwo, ios::app);
outfile << c2 << endl;
outfile.close();
break;
default:;
//printf( "Unknown return value\n" );
}
// clear status screen
printf("%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8);
printf(" ");
printf("%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8);
// refresh status
printf("%d", sorted);
// remove file
unlink (fia[ji].GetFilePath());
}
// wait before loop
Sleep(1000);
}
return 0;
}
todo....
:: insert inpirational text here ::
|
|
|
|
|