|
|
Well if you dont need to child windows you can hide them?
|
|
|
|
|
I have a dll I'm trying to plug in to someone else'e code. That DLL needs to have a few functions and I want to maintain a database connection inside the DLL over multiple functions calls in to the DLL. (Connecting and disconnecting inside each function call would be wasteful and possibly too slow). So I created a global pointer and assigned the pointer in the init function call. Like this:
Init function
CConnection* Connection = new Connection;
Data Access Function
Connection is now equal to null.
Initially I though the DLL was being reloaded so I have added logging functions and it is not. Why would a DLL lose the state of it's globals? Is there something different I can try to maintain state in a DLL?
|
|
|
|
|
This [http://support.microsoft.com/kb/125677] may help you.
- Malli...!
|
|
|
|
|
My project is SDI that use multiview.
When swap view to another I also want disable the old toolbar and change to the new one.
Please advise,How can I do this.
|
|
|
|
|
CToolBar::GetToolBarCtrl()<br />
CToolBarCtrl::EnableButton(int nID, BOOL bEnable = TRUE);
Regards,
Paresh.
|
|
|
|
|
Hello, I'm using RasSetEntryProperties() to create a modem connection. But I can't using the fifth and sixth parameters to configure the device,since the parameters aren't supported by WINXP. I need to change the property of the connection to disable the hardware functions like hardware flow control. I'm developing a tool for mobile to install the drivers to PC and construct a dialer for user to surf internet throw GPRS. The mobile will be as the modem. It doesn't need hardware flow control. I haven't found the useful information in register. How can I do? Please help me, thanks a lot!
My platform: Windows XP SP2, VC++6.0
Rock
|
|
|
|
|
|
hello,
Does anyone know how to print CEdit's text?
any ideas?
thanks
|
|
|
|
|
You will get the best results and not have to worry about if the text is scrolled off the CEdit control if you get the text and use CDC::TextOut or CDC::DrawText. However, I find most people have a negative reaction to that suggestion so if your determined to literally print the CEdit to a device context, CWnd::Print should do the job.
Just be forwarned, if you don't modify something (viewport extents, windows extents, etc...) in an appropriate mapping mode, it's gonna come out really, really, tiny on your printer. The best way to save a tree is to output your print tests to an Adobe Acrobat, PrimoPDF , or that new snazzy Vista XML print driver to see the results. That way you can zoom in really, really close to verify my statement.
After that you can experiment until way after Thanksgiving trying everything you can think of to get around all the pitfalls associated with trying to print a CEdit control (reliably) in all possible contexts and scenarios until you are ready to pull your hair out.
At that point, you can go back to my first suggestion and use TextOut or DrawText and smile once again knowing you did the right thing.
|
|
|
|
|
You can get your data with GetWindowText of edit control and use of TextOut or DrawText for print it.
|
|
|
|
|
In my VS8 MFC Dialog exploratory-app, the listbox and OK buttons flicker. I've tried the Double Buffer code (http://www.codeproject.com/bitmap/drawing_without_flicker.asp[^]) like this:
void CFlickerTestDlg::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
CRect rcClient; <br />
GetClientRect(rcClient);
<br />
CDC MemDC,*pDC;<br />
CBitmap MemBitmap;<br />
<br />
pDC = this->GetDC();
MemDC.CreateCompatibleDC(pDC);<br />
MemBitmap.CreateCompatibleBitmap(pDC,rcClient.right,rcClient.bottom);<br />
<br />
CBitmap *pOldBitmap = MemDC.SelectObject(&m_BmpTarget);<br />
<br />
pDC->BitBlt(0,0,rcClient.right,rcClient.bottom,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(pOldBitmap);<br />
}
but that didn't help, the listbox and OK buttons still flicker.
(also, I don't understand why my static image is covered up by some grey layer - but my main priority is the annoying flicker)
I've uploaded my project (255KB) here in a .zip:
http://www.webfilehost.com/?mode=viewupload&id=4066339[^]
There's a countdown timer on the bottom-right of the page that changes to a download link (I don't have any online webspace to share files so I had to resort to one of these free sharing services)
I'd be SO grateful for any help
|
|
|
|
|
The code you posted does nothing to prevent flicker.
I've been through your code and made some modifications to fix the flicker.
Having a picture control behind all the other controls is the problem.
It prevents you from clipping the other controls to prevent flicker.
I added the WS_CLIPCHILDREN style to the dialog, deleted the picture control from
the dialog's resource, and instead draw the bitmap to the window in response to WM_ERASEBKGND.
This way, Windows automagically clips all the child controls, so you don't have to redraw them on every
timer event.
Shoot me an email here and I'll send the changes in a reply.
BTW, the code leaks GDI resources on every timer event
I didn't look for those leaks.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
VS2005 C++ latest UPD. VS seems extremely lethargic lately. I now find its producing a "xxxxcache.dat" file, where xxxx is the project name. THis file runs 40 to 50 MEG. Whats causing this and how can I stop it from ocurring. It certainly was not doing this a year ago.
|
|
|
|
|
typedef struct {
DWORD dwValue;
BYTE bDummy[1020];
} CELL, *PCELL;
typedef CELL SPREADSHEET[g_nNumRows][g_nNumCols];
typedef SPREADSHEET *PSPREADSHEET;
CELL* m_pArray = (CELL*) VirtualAlloc(NULL, g_nNumRows * g_nNumCols,
MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE);
SPREADSHEET& g_ss = * (PSPREADSHEET) m_pArray ;
The above code snippet avoid to explicitly allocate for "g_nNumRows" * "g_nNumCols" cells, right? But reading it makes my head spinning, I think most of it origin from "typedef CELL SPREADSHEET[g_nNumRows][g_nNumCols];". Some statements just don't make sense to me grammatically: Why the reference '&' is needed here? What exactly happened when "* (PSPREADSHEET) m_pArray" was executed.(I'm always wondering what happens when something is casted to a build in and user defined data type, I've seen casting from PVOID to PBYTE for pointer manipulations)
Thank,
|
|
|
|
|
LiYS wrote: I'm always wondering what happens when something is casted
Don't wonder. Study the subject, get or find materials (like this for example[^] ) and read it until you understand.
|
|
|
|
|
LiYS wrote: Why the reference '&' is needed here?
Where?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
jhwurmbach wrote: SPREADSHEET& g_ss = * (PSPREADSHEET) m_pArray ;
|
|
|
|
|
:-OOk. Well....
I second the question of the original poster: Why are we taking a reference from that pointer?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
That little snippet of code makes my head hurt.
A C++ spreadsheet class implementing a multidimension array of CELL structs
is SO much cleaner to use, encapsulated, typesafe, etc., etc...
Hapy Thanksgiving man!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: That little snippet of code makes my head hurt.
Yeah, I thought about trying to explain that the wrong question was being asked but figured what the heck, they're all gone fishin
|
|
|
|
|
CELL* m_pArray = (CELL*) VirtualAlloc(NULL, g_nNumRows * g_nNumCols, <font color="Red"><-- shouldn't that be g_nNumRows * g_nNumCols * sizeof(CELL)</font>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The easiest way to understand typedef is that it works the same way as if you were declaring a variable. If you were declaring a 2d array of cells, you could use CELL array[g_nNumRows][g_nNumCols]; . If you put a typedef in front of the declaration, it gives a name to the type that such a variable would be.
The & is used to create a reference to the SPREADSHEET that will act like a value. In many cases, this is a good way to avoid using * for all your variable references, and to make sure you don't accidentally change the value of the pointer it hides. In this case, the effects are complicated by the way pointers act like arrays, so this might not be good code to start learning from.
The more appropriate way to write the last line might make more sense:
SPREADSHEET& g_ss = *reinterpret_cast<PSPREADSHEET>(m_pArray)
In this case, the C array/pointer equivalence is used again. Casting to and from void * is more common, and it is used for code that works on pointers without regard to the type pointed to.
I can see a couple problems in the code you have posted. The names of the array dimensions look like variable names, but array sizes declared that way have to be compile time constants. Also, there seems to be a sizeof(CELL) missing in the VirtualAlloc statement.
Nathan
|
|
|
|
|
Thanks Nathan,
Nathan Holt at EMOM wrote: The & is used to create a reference to the SPREADSHEET that will act like a value. In many cases, this is a good way to avoid using * for all your variable references, and to make sure you don't accidentally change the value of the pointer it hides. In this case, the effects are complicated by the way pointers act like arrays, so this might not be good code to start learning from.
This & references to array's address?
To me cast into user defined type in this scenario is just like stuff the memory into the target type's structure in byte.
|
|
|
|
|