|
Is there a way to create an MHT file from my program? It is my understanding that it is a multipart mime object, but I don't know how to create that either. Thanks for the help.
Darroll Walsh
|
|
|
|
|
Hey guys,
i wondered if anyone knows how to use this new screen in windows xp, which is used while the os is changing settings (e.g.: background-color, power off screen,...)
using: visual studio 6.0
greets ckr
|
|
|
|
|
Hi, I have MFC application with splitter window that divides client area to two views, both are CListView-derived classes. Because I want to keep columns to have stable proportions all the time, I'm catching CMyListView::OnSize() and executing this code:
void CMyFileView::OnSize(UINT nType, int cx, int cy)
{
int my_cx = cx;
INT iWidth = 0;
RECT viewRect;
::ZeroMemory(&viewRect, sizeof(RECT));
GetClientRect(&viewRect);
INT iViewLen = viewRect.right - viewRect.left;
CMultiColumnSortListView::OnSize(nType, cx, cy);
// disable horizontal scroll bar
GetListCtrl().ShowScrollBar(SB_HORZ, FALSE);
INT iColWidth = 0;
if (cx != old_cx)
{
GetListCtrl().ShowWindow(SW_HIDE);
for (INT i = 0; i < (COLUMN_NUM - 1); i++)
{
iColWidth = viewRect.right * COLUMN_WIDTHS[i];
iWidth += iColWidth;
GetListCtrl().SetColumnWidth(i, (viewRect.right * COLUMN_WIDTHS[i]));
}
GetListCtrl().SetColumnWidth((COLUMN_NUM - 1), (iViewLen - iWidth));
GetListCtrl().ShowWindow(SW_SHOW);
}
}
old_cx = cx;
}
I call ShowWindow() in order to stop flickering, it helped. The problem is, calling ShowWindow() deselectes selected item (selected before with SetItemState()). I tried to call SetItemState() again after ShowWindow(SW_SHOW), but it doesn't work as expected, it highlights item, but it doesn't select and focus it 100% (it just draw grey rectangle aroung the item, but doesn't display dark blue rectangle which appears in normal case).
Does somebody know what to do to select and focus the item again successfully?
Thanks for any suggestion.
|
|
|
|
|
Hey everybody..
I'm writing code that will display a popup menu when a user clicks an item in a listview control. In order to have the popup display right underneath the mouse cursor, I need to know the x.y position of where the user clicked in the list.
I've searched the help, but turned up nothing, is there a GetMousePos() type function kicking around?
Thanks.
Mike.
|
|
|
|
|
|
Yes. It is called ::GetMessagePos() and retrieves the position of the last message. If called in your click handler, you get the position of the click.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Is there a tool to create a report in VC6?
I want to print a table in my database
help me
thanks
|
|
|
|
|
Ok, one thing i hate the most about c++ is all the CStrings, strings, CEdits, chars, and whatnot.
I need to make my password (a CString) all into uppercase letters, but i cant just to password.toupper() like i can with a string, because my stupid password has to be a CString.
any help? :^x
*.*
cin >> knowledge;
|
|
|
|
|
I'm not sure I understand,
Why don't you just use the MakeUpper function?
// example for CString::MakeUpper
CString s( "abc" );
s.MakeUpper();
ASSERT( s == "ABC" );
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
hah! this just reiterates my hatred of this kinda stuff! Why do they have to use MakeUpper, why cant that just use toupper. jeepers creepers.
thanks, that was all i needed to know.
*.*
cin >> knowledge;
|
|
|
|
|
I want to generate a random number between a specified range of 1 to 100, how can I do this?
Thanks in advance, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
Technically, you can't generate a truly random number. You can, however, get pseudo-random numbers using rand() . For your specific range, try:
int x = (rand() % 100) + 1;
You may or may not also want to use srand() , which seeds the algorithm.
|
|
|
|
|
Thanks, I'll give it a try.
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
You'd better initialize the seed first. Use srand(time(NULL)).
Otherwise you will always get the same random number sequence.
|
|
|
|
|
Which is not necessarily a bad thing, especially when trying to reproduce a problem.
|
|
|
|
|
I have already ask the question but I cannot see it posted.
password displayed as ****
Thanks
rapace
|
|
|
|
|
already asked. correction
rapace
|
|
|
|
|
the question is ?
anyway, you can make the editbox look like a password field by setting a
style in the resource editor.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
:-DThank you.
Indeed by changing the setting of the property password from False to True.
As simple as that, yet one needs to know this.
Thanks again
rapace
|
|
|
|
|
no problem ...
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Hi,
Another very basic question... I am trying to save the contents of a listbox. I assume that the best way of doing this would be to add the contents list to a string array, something like the following:
void AddListBoxContentsToStringArray(HWND hWnd)
{
//get number of files in List Box:
int filecount = SendDlgItemMessage(hWnd,IDC_FILES,LB_GETCOUNT,0,0);
for(int currfile = 0; currfile < filecount; currfile++)
{
//(Somehow!) add filenames/paths to string array...
SendDlgItemMessage(hWnd,IDC_FILES,LB_GETTEXT,currfile,(LPARAM)(LPTSTR)szFileName[?]);
}
}
In the above example, szFileName[?] represents where I am guessing my string array should go...
My (very basic) question is, how do I define a string array that would work for this purpose and get something along the lines of the above code to work? (I'm using the Windows API with no MFC.) I'm a novice coder, and unfortunately I can't find anything about the basics string arrays in my Sam's and seem only to find very complex stuff when Googling...
All I actually need to do is save the contents of a listbox so that I can use it later.
Many thanks for any help,
KB
|
|
|
|
|
one easy way would be to use a std::string in an std::vector, you can then add elements with push_back, etc.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
char array[100][MAX_PATH];
void AddListBoxContentsToStringArray(HWND hWnd)
{
char szText[MAX_PATH];
int filecount = SendDlgItemMessage(hWnd, IDC_FILES, LB_GETCOUNT, 0, 0);
for (int currfile = 0; currfile < filecount; currfile++)
{
SendDlgItemMessage(hWnd, IDC_FILES, LB_GETTEXT, currfile, (LPARAM) szText);
strcpy(array[currfile], szText);
}
}
|
|
|
|
|
Thanks for the answers, I used David's code in the end as it was the easiest way to go. (Even though it took me a stupid amount of time to realise that I had to delete the items from my listbox in reverse order, because trying to delete file no. 7 isn't going to work if there are only 3 files left in there... d'oh.)
David Crow - thank you loads for all the help you have given me today. You have pretty much single-handedly written my listbox code (not that you'll ever see it, but I'll be sure to give you a shout in the readme ).
Many thanks,
KB
|
|
|
|
|