|
try to resize the window to zero by using the method call MoveWindow(...)
Good luck.
|
|
|
|
|
This is a wierd situation, and the solution is even wierder. I had to do this in an app a while ago and it took me a while to solve it.
Change this:
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
To this:
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
And add this:
m_nCmdShow = SW_HIDE;
Right before you register your doc templates.
Hope this helps,
Frank
|
|
|
|
|
Thanks for the info. It surprisingly worked, somewhat. It does start hidden but when the listview refreshes the first time (2-3sec after startup) it flashes on screen. I don't see why the m_nCmdShow is any different than just passing it a simple SW_HIDE but it works better. Thanks.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Ok, after further analysis I've discovered the problem. After the view refreshes I have a function called ProcessReminders() and in it if a reminder has the dialog option set that means show the window. I call showwindow on the mainframe ((CMainFrame*)AfxGetMainWnd())
and pass it SW_SHOW which causes it to be shown but then the app hides it do to the SW_HIDE value of m_nCmdShow. If I comment out the showwindow line everything starts up how I want it to, but if a reminder is set to show the window I need it to show.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Cool...glad you got it working the way you wanted.
Cheers!
Frank
|
|
|
|
|
In the program of a recognizer, I intend to set up a timer each time I finish a stroke, if a new stroke begins before the time out then reset the timer, otherwise invoke a function to recognize the strokes and kill the timer. It seems the SetTimer() can not be linked to an object. Is there any one knows how to do it?
|
|
|
|
|
|
See my reply to this question on PocketProjects.com
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Hi forum,
Questions:
Does anyone know how to retrieve the actual column arrangement?
Does anyone know how to do the drag/drop-operation programmatically?
Underlying concept:
I know that with a cole like this you may enable Drag & Drop Column arrangement in a CListCtrl:
DWORD dwStyle = List.GetExtendedStyle() | LVS_EX_FULLROWSELECT |
| LVS_EX_HEADERDRAGDROP;
List.SetExtendedStyle(dwStyle);
This is not only cool, it even works fine (if IE4 is installed).
Now I would like to save the column arrangment for a give CListCtrl to enhance my user interface.... (see questions)
Thanks for any ideas!!!
Thomas
|
|
|
|
|
|
1. Why this returns -1:
LONG xx=MCIWndOpenDialog(m_hMCIWnd), where hMCIWnd is a valid handle to the window created by calling:
m_hMCIWnd=MCIWndCreate(this->GetSafeHwnd(),
AfxGetInstanceHandle(), WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOTIFYSIZE|MCIWNDF_NOTIFYPOS,NULL);
No open dialog is shown.
2. Problem 2: Why "Open" selected from the popup menu lunched from the menu button doesn't do anything?
Jerzy
|
|
|
|
|
I'm using some code to attempt to open an AVI stream. The code compiles in visual c++, but gives me 3 fatal linking errors. These are the errors:
error LNK2001: unresolved external symbol _AVIStreamLength@4
error LNK2001: unresolved external symbol _AVIStreamReadFormat@16
error LNK2001: unresolved external symbol _AVIStreamOpenFromFileA@24
Debug/Capture.exe : fatal error LNK1120: 3 unresolved externals
The _AVI symbols are the names of the 3 functions I attempt to call - I assume they are in vfw.h, which I include. Ideas?
thanks-
jake
|
|
|
|
|
|
I'm using Windows NT 4.0 and Visual C++...
Anyone knows how to verify if a process is running in other machine whitout use registry key handles ?
|
|
|
|
|
Hi All,
How can I apply a shading to text in a Rich Edit Control?
CRichEditCtrl::SetBackgroundColor() changes the background
color for the entire CRichEditCtrl window, but how do I
just apply a shadding (or background color) to a selected
piece of text? Word is able to do it.
-Michael
|
|
|
|
|
You can set a background color for selected text using RichEdit 2.0 or later. Just pass CHARFORMAT2 structure to CRichEditCtrl::SetSelectionCharFormat and set crBackColor member to whatever you want.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Apparently when running my program under Win2000 I run into an assert under AppCore.cpp on the line
ASSERT(AfxGetThread() == NULL);
Might anyone have any quick insight to what might be happening. This happens right away before the main application window opens. If I ingore the assert the main application window appears as was intended.
I will keep plugging away with MSDN. I might get lucky with finding something. I don't know how new Win2000 is so I don't know if they would have anything out there. First glance I didn't see anything.
Thanks!
Chris
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
Can anybody point me towards a function that's something along the lines of:
int32 GetRandomNumberBetween(int32 nLower, int32 nUpper)
{
return nTheRandomNumber;
}
I just can't get it right myself, and I can't find one anywhere on the net or in my books.
Yours,
James Millson
|
|
|
|
|
Here is a quick and dirty one I hacked together from the CRT;
<br />
static long random_number = 1L;<br />
<br />
void SeedRandomNumber ( unsigned int seed )<br />
{<br />
random_number = (long)seed;<br />
}<br />
<br />
int GetRandomNumberBetween ( unsigned int lower, unsigned int upper )<br />
{<br />
return ( ( ( ( random_number = random_number * 214013L + 2531011L ) >> 16 ) & ( upper - lower ) ) + lower );<br />
}<br />
This is not thread safe, but should get you started.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
The trick with & will not work for majority of lower/upper pairs. For example: lower==0, upper==0x10000.
The other thing is that CRT random generator returns 16-bit values.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Your right, I should have specified that the largest difference between the upper and lower bounds could not exceed a 16-bit value and that the generated number is limited to 16 bits as well.
I supposed it depends on what he was using it for, personally I’ve never needed to use the functions for anything other that bogus test data for my app’s.
Have a good one,
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
The problem with & isn't limited to low/high ranges greater than 16 bits. lower==0, upper==0x10 will also give you trouble when used with bitwise and operator. The generator will be returning 0 or 16.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I have written this function and it gives me a random number between [nMin..nMax]
int RandBetween(int nMin, int nMax)
{
int r = (rand() * RAND_MAX + nMin) % nMax;
if (r <= nMin)
r = nMin+1;
else
if (r >= nMax)
r= nMax-1;
return r;
}
Mh2!
|
|
|
|
|
Shouldn't the nMin be outside the parenthesis?
|
|
|
|
|
Ok, here's my try
I decided to go the mundane inelegant math route (though I bet there are elegant ways to do this). This code computes a number in the range nLower to nUpper, and adds it to nLower. One major stumble is that you need to be able to store the range, so an int wont cut it.
Also, this code has a problem, in that it returns numbers from nLower to nUpper-1. You can extend the range by 1 in most cases, but you run into snarky special case code. I'll leave it like this - season to taste.
int GetRandomNumberBetween(int nLower, int nUpper){
int nTheRandomNumber = 0;
unsigned int range, offset;
float r;
assert( nUpper >= nLower );
range = (nUpper - nLower);
r = (float)rand() / (float)RAND_MAX;
offset = (int)(r * range);
nTheRandomNumber = nLower + offset;
TRACE(_T("nTheRandomNumber = %d\n"), nTheRandomNumber);
return nTheRandomNumber;
}
|
|
|
|