|
The debug information cant proceeded: most common case is that is a release build.
Greetings from Germany
|
|
|
|
|
No it is in the Debug Mode. Here is the confiiguration
/nologo /MTd /w /W0 /Gm /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR"Debug/" /Fp"Debug/Sockets.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /Zm200 /c
and
WIN32,_DEBUG,_WINDOWS,_MBCS
|
|
|
|
|
hello,
I set a value in registry. I checked the registry, the value was really set. And then I read it and try to print it. But the output is aways zero.
my code is:
char regValue[20];
unsigned long dataType;
RegOpenKey(HKEY_LOCAL_MACHINE,keyStr,&hkey);
dwRegValue = 100000;
RegSetValueEx(hkey,L"V1",0, REG_DWORD, (LPBYTE)&dwRegValue, sizeof(DWORD));
RegCloseKey(hkey);
RegOpenKey(HKEY_LOCAL_MACHINE,keyStr,&hkey);
RegQueryValueEx(hkey,L"V1",0, &dataType,(LPBYTE)regValue,&nSize);
RegCloseKey(hkey);
printf("\nregvalue: %d", atol(regValue)); //the output is: regvalue: 0
I don't know what's wrong with my code. could someone help me to solve the problem?
thanks in advance!
|
|
|
|
|
dadacncn wrote: char regValue[20];
Since you're retrieving a DWORD value, change the above, for instance into:
DWORD dwRegValueBack;
then you have also to change
dadacncn wrote: RegQueryValueEx(hkey,L"V1",0, &dataType,(LPBYTE)regValue,&nSize);
into:
RegQueryValueEx(hkey,L"V1",0, &dataType,(LPBYTE)&dwRegValueBack,&nSize);
and finally
dadacncn wrote: printf("\nregvalue: %d", atol(regValue)); //the output is: regvalue: 0
into:
printf("\nregvalue: %d", dwRegValueBack);
Hope that helps
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
thank you very much! it works!
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
dadacncn wrote: thank you very much! it works!
Just a comment, please use CRegKey class, which is optimized for this type of stuff!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
I have created a project using visual studio 2005 ,the details are given below.
I want to open power point slide and want to navigate this slides.
Here is the details
------------------------------
I am using Visual Studio 2005 (8.0)
File ->New -> Project
Visual C++ Project ->Win32 -> Win32 Project
Name=Oletest ,Saved to Desktop
Application Settings -> Windows Application -> Finish
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Oletest.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "Oletest.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_OLETEST, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_OLETEST);
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_OLETEST);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_OLETEST;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
hai,
what ever the code generated using wizard, u copied and pasted it here...Right...?
atleast try to start something ya...and then ask what are problems u had....
Cheers,
Mani
Born to win...!
|
|
|
|
|
I don't know how to handle ole
|
|
|
|
|
|
Hi to all.
In my app I deal vith OnMouseWheel and then callOnVScroll with SB_LINEUP/SB_LINEDOWN nSBCode.
This is slow for my needs, how to speed up scroling on my mouse wheeling?
Thanks in advance!
|
|
|
|
|
what about X * SB_LINEUP/DOWN ?? Where X is the number of lines that you want to.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
The SB_LINEUP/DOWN is a parametar which tells whether to scroll up or down, I don't think it has anything to do with speed.
I think I need to set bigger size of scroll line! Do it with SetScrollSizes !
Thanks for replay
|
|
|
|
|
The SB_LINEUP/DOWN is exactly what you say. And it comes from the SetScrollSizes, more or less 1/100 of the size.cy.
But what I said... is to get the WM_MOUSEWHEEL and multiply this SB_LINEUP with a coeficient. In order to make more than one line on each movement.
By default:
OnMouseWheel ()
{
if you are scrolling up
OnVScroll(SB_LINEUP, 0, NULL);
else
OnVScroll(SB_LINEDOWN, 0, NULL);
}
And what I am telling
OnMouseWheel ()
{
if you are scrolling up
OnVScroll( 3 * SB_LINEUP, 0, NULL);
else
OnVScroll( 3 * SB_LINEDOWN, 0, NULL);
}
with this you can use the normal Line size to Up/Down keys (for example) scrolling with accuracy, but do it faster with the mouse wheel. I you change the size of the line (another very good solution) then you will ALWAYS have that scroll velocity.
It is up to you and the needs of your project.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thank you veOnVScroll( 3 * SB_LINEUP, 0, NULL);ry much, you're sure right there!
It's great advice and sure I'm going to do so! At first I didn't see that way.
Thanks one more time!
|
|
|
|
|
I'm doing this:
<br />
BOOL CMyView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) <br />
{<br />
int pos =GetScrollPos( SB_VERT );<br />
if (zDelta>0) <br />
OnVScroll(3*SB_LINEUP,pos,NULL);<br />
else if (zDelta<0)<br />
OnVScroll(3*SB_LINEDOWN,pos,NULL);<br />
return TRUE;<br />
}<br />
When I scroll by LINEDOWN it's OK, but when I do the oposite (SB_LINEUP) it has no effect, scrolling it slow again.
Why?
Thanks!
|
|
|
|
|
Just handle the WM_MOUSEWHEEL message yourself - then you can scroll up / down by as big or small amounts as you like.
If you *don't* handle it, DefWindowProc will turn it into WM_VSCROLLs for you - which is making your life hard.
Iain.
|
|
|
|
|
Hi friends
How to move a window using its mousemove function
thanx
-RisKhan-
|
|
|
|
|
You can use of MoveWindow.
|
|
|
|
|
do you mean you want to move your window by dragging it by clicking on anywhere on the dialog?
|
|
|
|
|
|
Handle WM_NCHITTEST and always return HTCAPTION.
|
|
|
|
|
Just a little aside note.
"Moving your window by dragging it by clicking on anywhere on the dialog" is OK in one particular case: it has no menu, no system menu, no maximize/minimize/close button, no scrollbars and is not resizeable.
Returning always HTCAPTION from WM_NCHITTEST message handler leads in the impossibility of using menus,... and all enumerated above.
A little bit better approach is to apply the trick only for the client area.
Here is an example:
UINT CMyDialog::OnNcHitTest(CPoint point)
{
UINT nRet = CDialog::OnNcHitTest(point);
if(HTCLIENT == nRet)
{
nRet = HTCAPTION;
}
return nRet;
}
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|