I want to fully draw combobox control by myself, not only the list items. I searched but only found some demos about how to custom draw its subitems. But I really want to draw the edit, arrow button and listbox of the combobox completely. So, is there any example or idea?
Are you suppose to collect all the colors uses by an image & put them into different segment accordingly?
If so, then open image into binary format & create four matrix of R,G,B & O (offset values) considering each of them as a segment. Put each RGB values into corresponding martix. Thats all I guess.
I am developing one application that create Internet Shortcut and it is working fine. But in some system it fails to save and Send error message "Access Denied". How to resolve this issue??
Thanks in advance.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
I am trying to use a Dialog as a Control in another Dialog. MFC Documentation vaguely suggests this as something that can be done (you can set the 'Control' Property in the dialog you want to use as source. The help files and examples become 'thin on the ground' when it comes to how to actually do this. Anybody any ideas?
I do this a lot in one of my older applications. Suppose your two dialogs are IDD_MAIN and IDD_SUB, with corresponding MFC classes CMainDlg and CSubDlg. The resource for the sub dialog should have the following styles set: Border=None, Style=Child, and Control=True. This will let the sub dialog visually blend into the main dialog.
The basic approach is to use the sub as a modeless dialog whose parent is the main dialog. You then need something like this to get it going:
Obviously, there are lots of ways this needs to be fancied up. You probably want this sub-dialog positioned relative to other controls. What I usually do is place a static control where I want the sub-dialog to go, and then position the sub-dialog using logic like this:
This logic does several things: it gets the position of the static control, destroys it, and then places the sub dialog in the same position. As a final refinement, it assigns the control ID to the sub dialog.
Note that, for completeness, you really should save the pointer to the sub dialog instance as a member of the main dialog class, and delete it in that class' PostNcDestroy().
Hi! I have to do a project for my studies. It is a insertion algorithm.
I'm reading data from file with using vector.
then I'm copying vector to a normal array (the reason is simple: I don't know how to send vector to function, but this is not a main problem).
After copying, I'm sending (with using pointers) array to sorting function.
Everything is good, algorithm is working but! (yep, there is always but...
When I save a lot of data to file, program just after start crashes.
So there are 40 numbers in one line. I have 4.000 lines, so after simple math we have 160.000 numbers. The main problem: when I add some new numbers for example 40.000 program crashes
I must have more numbers because the task is to compare few sorting algorithms with minimum 15 minutes of sorting. (160.000 digits is sorting in ~1 minute)
Here's the code. Maybe it is poor written, but I did my best.
//written with Qt
using namespace std;
void insertion_sort(int *wsk, unsigned long size);
int main(int argc, char *argv)
QCoreApplication a(argc, argv);
//vector to hold data from file
vector <int> array_vector;
//stream to file
ifstream plik ("numbers.txt",ios::in);
//single number that is being readed from file
unsigned long single_number;
while(plik >> single_number)
//copying from vector to array
for (unsigned long a = 0; a < array_vector.size(); a++)
array_nonsorted[a] = array_vector[a];
time_t start,end; double long dif;
cout << "START\n";
cout << "STOP\n";
dif = difftime(end,start);
cout << "Array sorted in " << setprecision(5) << dif << "sec"; dif = dif/60; cout << " = " << dif << "minutes";
//cout << "End.";
void insertion_sort(int *wsk, unsigned long size)
//In final version I will do this by using pointers. I'm just copying it because with using pointers it's hard to see data in debugger
for(unsigned long i = 0; i < size; i++)
tab_sorted[i] = wsk[i];
//main sort engine
for (unsigned long a = 1; a < size; a++)
if (a == 1)
if (tab_sorted > tab_sorted)
unsigned long temp = tab_sorted;
tab_sorted = tab_sorted;
tab_sorted = temp;
for (unsigned long b = 0; b <= a-1; b++)
if (tab_sorted[a] < tab_sorted[b])
unsigned long temp = tab_sorted[a];
for (unsigned long c = a; c > b; c--)
tab_sorted[c] = tab_sorted[c-1];
tab_sorted[b] = temp;
So why the program crashes? I don't have a clue Something with memory (but I have 3.0GB and OS works normally when program is starting). Please help!
Maybe someone in the future will be searching solution for similar problem so I wrote it here.
So the problem is with stack array. Array is so large that it overflows the stack.
Solution is to use dynamically sized array. It can be vector class. In this example, it is sufficient to send pointer to function and in the sorting function working on vector. That's all.
Thanks to helios for helping me out
(from other cplusplus forum)
Last Visit: 31-Dec-99 18:00 Last Update: 16-Sep-21 0:19