|
hi all,
I'm calling MoveWindow, passing my HWND from my dialog app, and I also do a GetClientRect before and after the MoveWindow. For some reason, my dialog is being shrinked (shrunk) by 6 pixels (width and height).
Does anyone know the reason for this? I've done some hunting around without any luck.
Thanx
Jubjub
|
|
|
|
|
In MSDN
The MoveWindow function sends the WM_GETMINMAXINFO message. Handling this message gives CWnd the opportunity to modify the default values for the largest and smallest possible windows. If the parameters to the MoveWindow member function exceed these values, the values can be replaced by the minimum or maximum values in the WM_GETMINMAXINFO handler.
Would it because your maximum window size has been exceeded?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
hmm i don't think so. basically all i'm doing is a window that dodges the mouse. so if the mouse gets on the window as it is on the bottom left of the screen, then the window will move (via MoveWindow) to the top left of the screen.
so the window just moves from different corners of the screen. there is reason for my logic in this, but if i do a GetWindowRect and frmo that get the Width and Height of my window, when I call MoveWindow I pass in those values.
for some reason on moving the window, the window width and height decreases. I don't think my window size is exceeding it's limit as it should be staying the same.
|
|
|
|
|
Your previous codes uses GetClientRect.
Would it because in the process of calculation you have missed out nonclient area (including the title and scroll bars) if you are using GetClientRect?
And I noticed that CRect and RECT structure has slighly different data type members
typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
If you use CRect function size(), width() and height(). It will return int instead of LONG which could cast the value away. (Although I don't think that will happen)
hope this helps.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I did think about the client area, but the my dialog has no title bar, and even if it did, it wouldn't be 6 pixels high. I now have a child dialog within a dialog, and this 6 pixel problem no longer exists. so for now everything is ok, as long as the window i'm resizing is a child window.
seems really bizarre. i've resized other dialogs before (for example when you have an "advanced/simple" button, and never had this problem.
thanx for your help Anthony
|
|
|
|
|
this has caught me so many times
from msdn on CWnd::MoveWindow......
For a top-level CWnd object, the x and y parameters are relative to the upper-left corner of the screen. For a child CWnd object, they are relative to the upper-left corner of the parent window’s client area.
Does the dialog have a parent? if not call ClientToScreen to get the coords relative to the top left of the window.
hope that helps
|
|
|
|
|
hello
I post this question yesterday,but nobody answer it,so I posted it again,Maybe it's little and simple to you,but I really need your help.
how can I change the color of status bar with vc6? I mean the bottom of the window.
Thanks a lot.
hi all
|
|
|
|
|
|
Or you can simply do this:
YourStatusBar.GetStatusBarCtrl().SetBkColor(Color);
|
|
|
|
|
I've written a ZIP archiving app which can display the files in the archive in a ListView, like WinZip. I want to be able to drag a file out of the ListView onto an app so the app opens the file. I can get it to work when I drop the file onto the Desktop, but not onto an app/Desktop icon, much the same as Windows Explorer.
WinZip allows you to DnD a file from an archive onto an App.
Why can I drop it onto the Desktop, but not the App ?
How do you do this ? Are there any articles/examples on CodeProject ?
|
|
|
|
|
There are plenty of these articles in codeproject, like this one below,
http://www.codeproject.com/miscctrl/rdragdropfiles.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
|
I have a serrious problem.I've developed an application on VC6 that used to work fine. Now I have converted it on VC.NET 7.0 and builded in RELEASE configuration. The problem is that it only works on my computer. On other computers that don't have VC installed it just doesn't start. If started with depends.exe (XP Support Tools) it gives the following error:
Second chance exception 0xC00000005 (Access violation) occured in "NTDLL.DLL" at address 0x77F8243D
Exited "program" with code 128(0x80)
They have all the necesary dlls. What should I do? I'm disperate.
If there is an error in program why does it work on my computer fine, and on other computers without VC .NET installed crashes without any errors??
Contact: nemoprod@go.ro, www.nemoprod.go.ro .
|
|
|
|
|
I'm not an expert in any sense on this but I think you need the latest .net framework download from microsoft?
Also this is the visual c++ forum. You wanted the .net forum I think.
|
|
|
|
|
I've reinstalled Windows on my computer and then installed VS.NET 7.0 and the program isn't working on my computer either. I have the .NET framework installed. Somebody help. This is strange.
|
|
|
|
|
umm. I am trying to convert some existing code I found that performed a quicksort on an array using leftmost element as pivot. I want to make the pivot selection random but I have run into logic errors for a long time. It seems to work sometimes now but not all the time so there is still something wrong and I don't know what. If someone could take a look and tell me where i went wrong I would appreaciate it.
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <time.h>
#define NUM_ITEMS 100
int numbers[NUM_ITEMS];// = {6,24,80,4,19,84,1,10,13,7};
void print(void);
void quicksort(int beg, int end);
void sort(int beg, int end);
void swap(int left, int right);
int pivot(int beg, int end);
void selectsort(int left, int right);
void main(void)
{
int i;
//seed random number generator
srand((unsigned)time( NULL ));
//fill array with random integers
for (i = 0; i < NUM_ITEMS; i++)
numbers[i] = rand();
//perform quick sort on array
quicksort(0, NUM_ITEMS);
print();
exit(1);
}
void quicksort(int beg, int end)
{
sort(beg, end - 1);
}
void sort(int beg, int end)
{
int position;
if (beg > end)
return;
if (beg == end)
return;
position = pivot(beg, end);
sort(beg, position - 1);
sort(position + 1, end);
}
int pivot(int beg, int end)
{
int left = beg, right = end, pivot;
int rand_subscript;
rand_subscript = (int) ((right-left) * rand() / (RAND_MAX + 1)) + left;
pivot = numbers[rand_subscript];
while ((numbers[left] <= pivot) && (left < end))
{
left++;
}
while (numbers[right] > pivot)
{
right--;
}
while (left < right)
{
swap(left, right);
do
{
left++;
}while ((numbers[left] <= pivot) && (left < end));
do
{
right--;
}while (numbers[right] > pivot);
if (right == rand_subscript)
{
rand_subscript = left;
}
}
if ((numbers[right] != pivot) && (numbers[rand_subscript] == pivot))
swap(right, rand_subscript);
print();
return right;
}
void swap(int left, int right)
{
int hold;
hold = numbers[left];
numbers[left] = numbers[right];
numbers[right] = hold;
}
void selectsort(int left, int right)
{
int l = left, r = right;
int ltemp, value, l_inc;
for (l;l<right;l++)
{
l_inc = l + 1;
ltemp = l;
value = numbers[l];
for(l_inc;l_inc<=right;l_inc++)
{
if (numbers[l_inc]<value)
{
ltemp = l_inc;
value = numbers[l_inc];
}
}
numbers[ltemp] = numbers[l];
numbers[l] = value;
}
}
void print(void)
{
int i;
for (i = 0; i < NUM_ITEMS; i++)
{
printf("%i, ", numbers[i]);
}
printf("\n\n");
}
|
|
|
|
|
FreeLemons wrote:
rand_subscript = (int) ((right-left) * rand() / (RAND_MAX + 1)) + left;
I think this should be:
rand_subscript = (rand() % (right - left + 1)) + left;
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am using Visual C++ 6.0 and am having problems with the threads dialog box. I find that after suspending execution and opening the threads box, sometimes not all the threads in the process are displayed. I can see the threads in a suspended state in Spy++ though.
Has anyone encountered this problem? Any help would be appreciated.
thanks
Man Learns from History that he never learns from History
|
|
|
|
|
I'm sure there's a C++ expert who can explain who to overload the indirection to a member and deferencing a pointer.
<br />
class A{<br />
int m_i;<br />
float *m_pf<br />
};
My questions are how to use operator -> to return m_i, ->* to return m_pf.
What parameters to I use when create the method.
Does it work when you create a pointer to an object of type classA?
|
|
|
|
|
Well techincally it would be like this:
class A
{
public:
int m_i;
float *m_pf;
int operator->() const
{
return m_i;
}
float& operator*() const
{
return *m_pf;
}
};
But - while the * operator makes sense, the -> makes none at all. Why would you want a -> operator to return a basic type? (ie not a pointer to a class)
In fact, I belive if you compile the above you will get:
warning C4284: return type for 'A::operator ->' is 'int' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation)
return type for 'identifier::operator –>' is not a UDT or reference to a UDT. Will produce errors if applied using infix notation
The operator–>( ) function must return either a pointer to a class or an object of or a reference to a class for which operator–>( ) is defined.
The following example causes this warning:
class C
{
public:
int operator->(); // warning
};
It is meaningless to apply the member access operator to fundamental data types that have no member access. This warning message will appear when this happens.
|
|
|
|
|
It seems if I try to delete a record programmically using ADO with special characters (i.e Â) I will always get an unhandled exception error. But if I delete all records with special characters in them then run the delete program again, it works fine. Does this sound like a bug in ADO or did I forget something extra for special characters?
thanks!
|
|
|
|
|
How did you access your DBMS? Through ODBC using ADO?
Is the working program using the same database access engine? (like ODBC driver or BDE or others)
Sometimes some drivers do not support certain SQL syntaxes or characters. (mostly to maintain compatibility across platforms like ODBC)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thanks! However I noticed something strange in the DB and believe the problem occurred because for some reason unknown, duplicate records were inserted especially where a primary key has been defined and I think it bombed on not knowing what to delete or just that the rules of a primary key field were broken with the duplicate records. [ ]
oh well...
|
|
|
|
|
Hi...
PLZ.. let me know any hint to manage size of CFormView dynamically...
Thanks...Have a Nice Life
---Sumit Kapoor---
|
|
|
|
|
Describe what the main windows.
Kuphryn
|
|
|
|