Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 18th, 2005, 3:04 PM   #11
iignotus
Professional Programmer
 
iignotus's Avatar
 
Join Date: Apr 2005
Location: Nowhere Special
Posts: 466
Rep Power: 4 iignotus is on a distinguished road
Send a message via AIM to iignotus
Isn't there still an amendment up in the air to abolish software patents in EU?
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[ 
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;}
iignotus is offline   Reply With Quote
Old Oct 18th, 2005, 3:11 PM   #12
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3 ivan is on a distinguished road
Don't know iignotus, but the whole thing with patents is totaly insane...
ivan is offline   Reply With Quote
Old Oct 18th, 2005, 3:13 PM   #13
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
Quote:
Originally Posted by ivan
...but the whole thing with patents is totaly insane...
Especially along the lines of the ones in the article posted by stevengs...
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Oct 18th, 2005, 10:03 PM   #14
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 816
Rep Power: 4 The Dark is on a distinguished road
Here is some information and sample code for making a progress bar.
The Dark is offline   Reply With Quote
Old Oct 19th, 2005, 7:18 AM   #15
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
Thanks The Dark, the more info the better at this point.

-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Oct 19th, 2005, 11:06 AM   #16
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
getting a linker error, probly just some stupid mistake on my part due to not fully understanding all the functions.

[Linker error] undefined reference to 'InitCommonControls@0'

Anyone know what that means?

**NOTE** Program is not finished, there is no instructions to be executed yet for when the "Recover Screens" button is clicked. nor anything for the stepping part of the progress bar.

 
/*
 * A basic Win32 program that will
 *
 * delete any locked Advantage 
 *
 * Screens from the local system.
 */
#include <windows.h>
#include <string.h>
#include <iostream>
#include <commctrl.h>

/*
 * This is the window function for the main window. Whenever a message is
 * dispatched using DispatchMessage (or sent with SendMessage) this function
 * gets called with the contents of the message.
 */
LRESULT CALLBACK
MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
/* The window handle for buttons. */
static HWND hwndfinish = 0;
static int cx, cy;/* Height and width of Finish button. */
static HWND hwndrcvr = 0;
static int rx, ry;/* Height and width of Recover button. */
HWND hwndPB; /* Handle of progress bar */
HDC hdc;/* A device context used for drawing */
PAINTSTRUCT ps;/* Also used during window drawing */
RECT rc;/* A rectangle used during drawing */
/*
 * Perform processing based on what kind of message we got.
 */
switch (nMsg)
{
case WM_CREATE:
{
/* The window is being created. Create our button
 * window now. */
TEXTMETRIC tm;
/* Use the system fixed font size to choose
 * a nice button size. */
hdc = GetDC (hwnd);
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
GetTextMetrics (hdc, &tm);
cx = tm.tmAveCharWidth * 15;
cy = (tm.tmHeight + tm.tmExternalLeading) * 2;
rx = tm.tmAveCharWidth * 25;
ry = (tm.tmHeight + tm.tmExternalLeading) * 2;
ReleaseDC (hwnd, hdc);
/* Now create the button */
hwndfinish = CreateWindow (
"button",/* Builtin button class */
"Finish",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
600, 450, cx, cy,
hwnd,/* Parent is this window. */
(HMENU) 1,/* Control ID: 1 */
((LPCREATESTRUCT) lParam)->hInstance,
NULL);
//Now create the button 
hwndrcvr = CreateWindow (
"button",// Builtin button class 
"Recover Screens",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
280, 150, rx, ry,
hwnd,// Parent is this window. 
(HMENU) 2,// Control ID: 2 
((LPCREATESTRUCT) lParam)->hInstance,
NULL);
return 0;
break;
} 
case WM_DESTROY:
/* The window is being destroyed, close the application
 * (the child button gets destroyed automatically). */
PostQuitMessage (0);
return 0;
break;
case WM_PAINT:
/* The window needs to be painted (redrawn). */
hdc = BeginPaint (hwnd, &ps);
GetClientRect (hwnd, &rc);
/* Draw directions at top of screen*/
SetTextColor(hdc, RGB(200,220,255)); SetBkColor(hdc, RGB(125,125,125));
rc.top = rc.top + 5;
DrawText (hdc, "-=| Advantage Screen Recovery |=-", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SetTextColor(hdc, RGB(255,255,255)); SetBkColor(hdc, RGB(125,125,125));
rc.top = rc.top + 18;
DrawText (hdc, "If you are getting a warning message saying your printers are not configured", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
rc.top = rc.top + 18;
DrawText (hdc, "for this workstation, please run this program now. Also you should run it if", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
rc.top = rc.top + 18;
DrawText (hdc, "your first Advantage window to open is anything other than ABCS1.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
rc.top = rc.top + 25;
SetTextColor(hdc, RGB(255,0,0)); SetBkColor(hdc, RGB(0,0,0));
DrawText (hdc, "**NOTICE** Close all Advantage windows before continuing!**", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SetTextColor(hdc, RGB(255,255,255)); SetBkColor(hdc, RGB(125,125,125));
rc.top = rc.top + 25;
DrawText (hdc, "To Continue, click the Recover Screens button.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
EndPaint (hwnd, &ps);
return 0;
break;
case WM_COMMAND:
/* Check the control ID, notification code and
 * control handle to see if this is a button click
 * message from our child button. */
if (LOWORD(wParam) == 1 &&
	HIWORD(wParam) == BN_CLICKED &&
	(HWND) lParam == hwndfinish)
{
/* Finish button was clicked. Close the window. */
DestroyWindow (hwnd);
}
else
{
if (LOWORD(wParam) == 2 &&
	HIWORD(wParam) == BN_CLICKED &&
	(HWND) lParam == hwndrcvr)
{
// Recover button was clicked. Delete files and show progress bar. 
	// Set the range and increment of the progress bar.
	SendMessage(hwndPB, PBM_SETRANGE, 0, 100); 
	SendMessage(hwndPB, PBM_SETSTEP, (WPARAM) 1, 0); 
/*add delete code here*/
	   // Advance the current position of the
	   // progress bar by the increment. 
	   SendMessage(hwndPB, PBM_STEPIT, 0, 0); 
}
}
return 0;
break;
}
/* If we don't handle a message completely we hand it to the system
 * provided default window function. */
return DefWindowProc (hwnd, nMsg, wParam, lParam);
}

int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
HWND hwndMain;/* Handle for the main window. */
HWND hwndPB; /* Handle of progress bar */
MSG msg;/* A Win32 message structure. */
WNDCLASSEX wndclass;/* A window class structure. */
char*szMainWndClass = "WinTestWin";
/* The name of the main window class */
/*
 * First we create a window class for our main window.
 */
/* Initialize the entire structure to zero. */
memset (&wndclass, 0, sizeof(WNDCLASSEX));
/* This class is called WinTestWin */
wndclass.lpszClassName = szMainWndClass;
/* cbSize gives the size of the structure for extensibility. */
wndclass.cbSize = sizeof(WNDCLASSEX);
/* All windows of this class redraw when resized. */
wndclass.style = CS_HREDRAW | CS_VREDRAW;
/* All windows of this class use the MainWndProc window function. */
wndclass.lpfnWndProc = MainWndProc;
/* This class is used with the current program instance. */
wndclass.hInstance = hInst;
/* Use standard application icon and arrow cursor provided by the OS */
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
/* Color the background gray */
wndclass.hbrBackground = (HBRUSH) GetStockObject (GRAY_BRUSH);
/*
 * Now register the window class for use.
 */
RegisterClassEx (&wndclass);
/*
 * Create our main window using that window class.
 */
hwndMain = CreateWindow (
szMainWndClass,/* Class name */
"Advantage Screen Recovery 3.0",/* Caption */
WS_OVERLAPPEDWINDOW,/* Style */
CW_USEDEFAULT,/* Initial x (use default) */
CW_USEDEFAULT,/* Initial y (use default) */
CW_USEDEFAULT,/* Initial x size (use default) */
CW_USEDEFAULT,/* Initial y size (use default) */
NULL,/* No parent window */
NULL,/* No menu */
hInst,/* This program instance */
NULL/* Creation parameters */
);
// Create Progress Bar
int cyVScroll;  // Height of scroll bar arrow 
extern HINSTANCE hInstance;
	InitCommonControls(); 
   
	hwndPB = CreateWindowEx(
	0,
	PROGRESS_CLASS,/* class name */
	(LPSTR) NULL,
	WS_CHILD | WS_EX_CLIENTEDGE,/* Style */
	100,/* Initial x */
	300,/* Initial y */
	500,/* Initial x size */
	50, /* Initial y size */
	hwndMain, /* Parent is this window. */
	(HMENU) NULL,
	hInst,/* this program instance */
	NULL /* creation parameters */
	); 
/*
 * Display the window which we just created (using the nShow
 * passed by the OS, which allows for start minimized and that
 * sort of thing).
 */
ShowWindow (hwndMain, nShow);
UpdateWindow (hwndMain);
/*
 * The main message loop. All messages being sent to the windows
 * of the application (or at least the primary thread) are retrieved
 * by the GetMessage call, then translated (mainly for keyboard
 * messages) and dispatched to the appropriate window procedure.
 * This is the simplest kind of message loop. More complex loops
 * are required for idle processing or handling modeless dialog
 * boxes. When one of the windows calls PostQuitMessage GetMessage
 * will return zero and the wParam of the message will be filled
 * with the argument to PostQuitMessage. The loop will end and
 * the application will close.
		 */
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}

Thanks,
-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Oct 19th, 2005, 7:28 PM   #17
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 816
Rep Power: 4 The Dark is on a distinguished road
InitCommonControls is in comctl32.lib, so you need to add that library to your project or linker line.

Note that your hwndPB variable in MainWndProc is never set to anything, so the set range message calls wont work. You need to find the progress bar control's window handle again in the MainWndProc (maybe give the PB a known ID, or even stick the hwndPB in a global variable).
The Dark is offline   Reply With Quote
Old Oct 24th, 2005, 8:31 AM   #18
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
I am still having problems getting it to work, guess this would be a good time to try and learn better. I broke down and bought MS Visual C++ .NET and the huge book they have for it. Going to be spending quite a few nights reading and trying to get used to the new program. Thanks to everyone for the help.

-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Oct 24th, 2005, 4:08 PM   #19
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by badbasser98
I am still having problems getting it to work, guess this would be a good time to try and learn better. I broke down and bought MS Visual C++ .NET and the huge book they have for it. Going to be spending quite a few nights reading and trying to get used to the new program. Thanks to everyone for the help.

-BB98
LOL you're too funny.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Oct 25th, 2005, 12:31 AM   #20
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
i wish i could break down and buy it, isn't it like $679.00 or something?
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:19 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC