|
Please add the ON_UPDATE_COMMAND_UI handler for the Button .
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
The controls are disabled because you don't have WM_COMMAND handlers for them yet. Either add handlers, or set the main frame's m_bAutoMenuEnable member to false .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I have a VC++ 6 project with the following:
template <typename T> class tPointer {
public:
protected:
T *pPointer;
tUnsignedWord pCounter;
};
template <typename T> class tArray : public tPointer<T> {
public:
protected:
tUnsignedWord nSize;
};
But when I write:
int main( void )
{
tArray<int> p;
p.
return 0;
}
The problem is:
1) That list as the elements: nSize (fine with that) and pData (hã??)
2) tArray is not inheriting the routines from tPointer (i.e operator = ( tSomething ) )
Anybody knows why and how to solve this?
NOTE: I wrote a tArray class on a previous project that had a pData member.. Is it possible that VC++ keeps some sort of records and is now accessing them? Plus, those are the only files I have included in the project so far.
best regards [[]]
hint_54
|
|
|
|
|
HI,
I request you to kindly help me out as soon as possible.It is extremely urgent.
Please tell me how to "Add a FormView and creat a Tab Control on the form view in a Single Document(SDI) based VC++ program using MFC."
I dont want to make it a Formview based application since it would not support printing options.
Hence I would like to add form view to the SDI based application,and then add a tab control on the form view,making the form view the main window.Subsequently,the tab control should be linked via code so that each tab behaves as a child dialog box.May I request you to kindly provide a solution in detail.I would be extremely grateful.
Thank You very much.
|
|
|
|
|
Hi,I have a sdi multiview program,when i successful display
the second CListView.I found that the scroll bar was not work,I can handle OnInitialupdate() after listview create
,the Listview's column was displayed,but how can I handle
with the Listview's scroll bar.Anyone can help?thanks.
|
|
|
|
|
hi all,
i want to develop one application in VC++ - MFC which can read a selected PDF file and store that thing to database. before that i want to know , how can i read a pdf file in VC++ (i.e.,) either in binary or some other format.
send reply .,., it's urgent
Try again and again,
At last you will say
I don't know the meaning for impossible.,.
-- modified at 10:46 Tuesday 6th June, 2006
|
|
|
|
|
See here[^] if you find an article that may help you. THe pdf is proprietary format, so do not expect a description of the file format.
~RaGE();
|
|
|
|
|
maharaja pandian wrote: how can i read a pdf file...
Here is an older version of the format.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
im not sure but Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
I want to display two buttons and a coustom control on my own custom control that used as a panel.(as i know,there is no panel control in vc 6.0)
But it cannot work.
I thought in Onpaint() i can send WM_ONPAINT message to every control on this panel, let them draw their own. But i failed...
what is the right method?
thank you for help.
kudoo
|
|
|
|
|
Each of your controls should receive the WM_PAINT message automatically. It is up to Windows to decide when to redraw a control, so you do not need to post this message. If you want to invoke redrawing of controls, you can use InvalidateRect or InvalidateControl functions.
|
|
|
|
|
Hi ,
Can I create SDL(simple Directmedia layer) With som other window control on the single window ....(Either in MFC/win32)
But below is the sample code which creates a window and just place a SDL screen on it. but what i need is to place some button(like play,stop,pause) beside the sdl screen in the same window...
/* Simple program: Fill a colormap with gray and stripe it down the screen */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32
# include <windows.h>
# include "Resource.h"
static HWND g_hwnd;
#endif /* WIN32 */
#include "SDL.h"
#ifdef TEST_VGA16 /* Define this if you want to test VGA 16-color video modes */
#define NUM_COLORS 16
#else
#define NUM_COLORS 256
#endif
HWND g_hToolbar = NULL,hWndToolbox;
/******************************************************************************/
LRESULT CALLBACK ToolboxProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
}
return FALSE;
}
/**********************************************************************************/
BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_PRESS:
MessageBox(hwnd, "Hi!", "This is a message",
MB_OK | MB_ICONEXCLAMATION);
break;
case IDC_OTHER:
MessageBox(hwnd, "Bye!", "This is also a message",
MB_OK | MB_ICONEXCLAMATION);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
/SDL_Surface *CreateScreen(Uint16 w, Uint16 h, Uint8 bpp, Uint32 flags)
{
SDL_Surface *screen;
int i;
SDL_Color palette[NUM_COLORS];
Uint8 *buffer;
/* Set the video mode */
screen = SDL_SetVideoMode(320, 240, bpp, flags);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set display mode: %s\n",
SDL_GetError());
return(NULL);
}
fprintf(stderr, "Screen is in %s mode\n",
(screen->flags & SDL_FULLSCREEN) ? "fullscreen" : "windowed");
/* Set a gray colormap, reverse order from white to black */
for ( i=0; i<num_colors; ++i="" )="" {
palette[i].b="(NUM_COLORS-1)-i" *="" (256="" num_colors);
palette[i].g="(NUM_COLORS-1)-i" num_colors);
palette[i].r="(NUM_COLORS-1)-i" num_colors);
}
sdl_setcolors(screen,="" palette,="" 0,="" num_colors);
="" set="" the="" surface="" pixels="" and="" refresh!=""
if="" (="" sdl_locksurface(screen)="" <="" 0="" {
fprintf(stderr,="" "couldn't="" lock="" display="" surface:="" %s\n",
sdl_geterror());
return(null);
}
buffer="(Uint8" *)screen-="">pixels;
for ( i=0; i<screen->h; ++i ) {
memset(buffer,(i*(NUM_COLORS-1))/screen->h, screen->w);
buffer += screen->pitch;
}
SDL_UnlockSurface(screen);
SDL_UpdateRect(screen, 0, 0, 0, 0);
return(screen);
}
#ifdef WIN32
LRESULT CALLBACK graywinWindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
SDL_Event event;
switch(uMsg) {
case WM_COMMAND: /* LOWORD find exact event */
switch(LOWORD(wParam)) {
case ID_QUIT :
event.type = SDL_QUIT;
SDL_PushEvent(&event);
break;
case ID_DIALOG_SHOW:
ShowWindow(g_hToolbar, SW_SHOW);
break;
case ID_DIALOG_HIDE:
ShowWindow(g_hToolbar, SW_HIDE);
break;
}
break;
case WM_CREATE:
g_hToolbar = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_TOOLBAR),
hwnd, ToolDlgProc);
if(g_hToolbar != NULL)
{
ShowWindow(g_hToolbar, SW_SHOW);
}
else
{
MessageBox(hwnd, "CreateDialog returned NULL", "Warning!",
MB_OK | MB_ICONINFORMATION);
}
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
break;
}
return 1;
}
int init_win32_window(HINSTANCE hInst, int width, int height) {
MSG msg;
char windowid[100];
WNDCLASSEX wcex;
RECT rect;
ZeroMemory(&wcex, sizeof(wcex));
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW;
wcex.lpfnWndProc = graywinWindowProc;
wcex.hInstance = hInst;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON));
wcex.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
//wcex.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
wcex.lpszClassName = "Mainframe";
if (!RegisterClassEx(&wcex)) {
MessageBox(NULL, "could not register class", "Error", MB_ICONERROR);
return 0;
}
ZeroMemory(&rect, sizeof(RECT));
rect.right = width ;
rect.bottom = height +height;
// AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, TRUE, 0);
g_hwnd = CreateWindowEx(
WS_EX_STATICEDGE ,
"Mainframe",
"SDL Window",
0 ,
CW_USEDEFAULT,
CW_USEDEFAULT,
abs(rect.left) + rect.right,
abs(rect.top) + rect.bottom ,
NULL,
LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU)),
hInst,
NULL);
if (!g_hwnd) {
MessageBox(NULL, "could not create window", "Error", MB_ICONERROR);
return 0;
}
// Create a child window based on the available dialog box
hWndToolbox = CreateDialog(hInst,
MAKEINTRESOURCE(IDD_TOOLBOX_DLG),
g_hwnd,
(DLGPROC)ToolboxProc);
ShowWindow (hWndToolbox, SW_SHOW);
ShowWindow(g_hwnd ,SW_SHOWNORMAL );
while (GetMessage(&msg,NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
ShowWindow(g_hwnd, SW_SHOWDEFAULT );
UpdateWindow(g_hwnd);
strcpy(windowid, "SDL_WINDOWID=");
_ltoa((long)g_hwnd, windowid + 13, 10);
_putenv(windowid);
return 1;
}
#endif /* WIN32 */
int main(int argc, char *argv[])
{
SDL_Surface *screen = NULL;
Uint32 videoflags;
int done;
SDL_Event event;
Uint16 width, height;
Uint8 bpp;
/* See if we try to get a hardware colormap */
width = 320;
height = 240;
bpp = 8;
videoflags = SDL_SWSURFACE;
# ifdef WIN32
init_win32_window(GetModuleHandle(NULL), width, height);
# endif
//#ifdef XX
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
// Set a video mode
screen = CreateScreen(width, height, bpp, videoflags);
if ( screen == NULL ) {
exit(2);
}
// Wait for a keystroke/
done = 0;
while ( !done && SDL_WaitEvent(&event) ) {
switch (event.type) {
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
SDL_Quit();
//#endif
return(0);
}
Manjunath S
GESL
Bangalore
|
|
|
|
|
I already asked you this question but I will ask again (maybe you will stop flooding the forums): what do you want to achieve exactly by mixing MFC (which not at all the case in your example) and SDL ? I already worked with SDL so I know how it works and how to use it. Basically, mixing SDL and MFC doesn't sound like a good idea. If you want to use it to manage events, then forget about it, because MFC won't let you easily manage that. If the purpose is only to paint a SDL surface in a MFC window, maybe this link[^] could be usefull.
But from what I see, you don't have any experience with MFC or win32 (this code looks like cut and paste). I strongly suggest you to learn that first (which could be time consuming).
Now, if you want to have a GUI system to work in cooperation with SDL, then I suggest you that you take a look at CEGUI[^] (as I already said previously, but without success).
And please, stop flooding the forums with the same question over and over again, unless you provide more information about what you are trying to achieve exactly.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Can i get any sample code for GUI system to work in cooperation with SDL...
It helps me a lot
Thanking you
Manjunath S
|
|
|
|
|
Geez, can't you simply read what I've posted ? It's incredible !!
I also asked you for more information, if you don't want to spend some time in describing your problem, then, there is no solution for you.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hi,
well,What i need is a SDL screen in MFC/Win32 application ,with button beside that screen , so that by pressing button(like play,pause,stop) i can call sdl function to act according on sdl screen...This screen display images captured by cam. we have Back end code of SDL.But i need one Window with GUI interface ....
Thanking you
Manjunath S
GESL
Bangalore
|
|
|
|
|
Manjunath S wrote: This screen display images captured by cam
This is ridiculous. You use SDL just to display images from a camera ? Why don't you use another technique (don't know which one but this looks like a very bad solution to me).
Manjunath S wrote: well,What i need is a SDL screen in MFC/Win32 application ,with button beside that screen , so that by pressing button(like play,pause,stop) i can call sdl function to act according on sdl screen
Did you even bother to follow the links I gave you ? One of the link describes how to render SDL surfaces in a win32 environment.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hi,
Can I get any other solution for this(i.e SDL in MFC/Win32).If there please inform me.
Can i get link once again, Please explain me how to create buttons beside that screen.
Thanking you
Manjunath S
GESL
Bangalore
|
|
|
|
|
Manjunath S wrote: Can i get link once again
that's stupid... scroll the page up and reach Cedric previous posts to see the links
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
I am trying to get the Microsoft Windows installation key (the serial number) in my VC6 C++ program. The key can be found from XP->Control Panel->System->General. For example, the key on my computer is "55276-OEM-0011901-00102". Does anybody know how to get the string in C++ program?
Thanks in advance
|
|
|
|
|
//how about using GetVolumeInformation() .
Viorel is correct.I checked it with MSDN
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 9:54 Tuesday 6th June, 2006
|
|
|
|
|
I think GetVolumeInformation actually returns another kind of information -- the disk's serial number (the same which is shown by the vol command).
|
|
|
|
|
If you are familiar with Windows Management Instrumentation (WMI), then you can obtain the Serial Number through the Win32_OperatingSystem WMI class, which has the SerialNumber data member as a string.
See Win32_OperatingSystem class and WMI-related information.
|
|
|
|
|
ytsau wrote: Does anybody know how to get the string in C++ program?
Just read it from the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductId
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for all the replies!
How do I read the registry? Can you show me the actual C code?
Thanks again!
|
|
|
|
|