|
am not 100% sure you can do that from ur app using sql or whatever ... u might have to get into icky stuff like controlling access as a ole whatsit
maybe theres an easy way but i dont know it
"... and so i said to him ... if it don't dance and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I think that you could do it in DAO, not sure about ADO/ADO.NET though.
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
To compact Access 2000 database:
try
{
CString s;
s.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s",sPath);
CString d;
d.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Jet OLEDB:Engine Type=%d",
sTempPath, iVersion);
JRO::IJetEnginePtr jet(__uuidof(JRO::JetEngine));
jet->CompactDatabase(s.operator LPCTSTR(),
d.operator LPCTSTR());
CopyFile(sTempPath, sPath, FALSE);
DeleteFile(sTempPath);
}
catch(_com_error &e)
{
::MessageBox(NULL, (LPCTSTR)e.Description(), "Compact database error.", MB_OK);
}
Maxwell Chen
Lets make bugs better!
|
|
|
|
|
I know this is a little off-topic, but here it is anyway!
I'm desparately trying to install VS.Net and keep getting this error before installing the Windows Components:
"Setup has detected that another program requires the computer to reboot. You must reboot the computer before installing Visual Studio .NET Windows Component Update. Once the system reboots, you need to restart setup. Click OK to reboot. Click Cancel to exit setup and install later".
I've rebooted many times and keep getting the error. Now, what I'd like to do is find out where the setup looks for to determine that the computer needs to reboot and just change the value.
Any idea on how to do that? I'm desparate and I don't want to format my hard drive.
Thanks
Francis
|
|
|
|
|
Can You help me with system tray. I try, but cant do next:
Need to show string in system tray like system clock, but length of the string
is changed in time ( every 10 sec).
If i make in tray some ICON with NOTIFYICONDATA , there is interval between
icons and place of icons may changed if ohher application add/remove own icons from tray. String not correctly displayed.
With Spy++ i find out that sysmem tray ( TrayNotifyWnd ) contains
ToolbarWindow32 (with icons), and TrayClockWClass (system clock)
Is is possible to display string in the tray like system clock.
Possible to get sources of system clock (TrayClockWClass).
Thank You for an advice.
|
|
|
|
|
I have an ActiveX control developed with MFC. It runs it Internet Explorer. I want the container to access a structure defined in the control. How do I do that ?
struct Properties{
int length;
..........
}prop;
Thanks
|
|
|
|
|
add an interface to the control that allows you to get the data from the structure.
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
Does anyone now how to open/close a deskband(on the taskbar) programatically? Also, is there a way to make explorer release the deskband? I created a deskband, but if you close it explorer still holds on to it. So you can't delete it without closing explorer.
Thanks
|
|
|
|
|
I have a list control and i want to retrieve either the text or the item number (doesn't matter) of the selected item in the control, but everything I try fails.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Use GetFirstSelectedItemPosition to get the selected item.
Now use GetItemText to get the text.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi, everyone,
Recently I am thinking of using one pointer to access two different class. I don't know how to do this.
Here is the detail description:
I've a document class CMyDoc with a view class CCView.
In CCView's OnDraw function, I want to use one pointer pDoc->pCurImage to draw a image (eg. pDoc->pCurImage->Draw()). Because the two image buffer class are similar. They both have a draw function(and a lot of other function except their data type are diferrent). When I load an image from a file, the color image will be loaded into the color buffer(m_ColorImage), and the gray scale image will be loaded into the B/W buffer(m_BWImage), then a pointer m_pCurImage will pointer to the correct image buffer for the view class to display it.
But since the pointer type is (void*), how can a view class to use it.
Or is there any other elegant way to do the same job?
class CMyDoc : public CDocument
{
protected: // create from serialization only
CMyDoc();
DECLARE_DYNCREATE(CMyDoc)
public:
CBWImage m_BWImage;
CColorImage m_ColorImage;
void* m_pCurImageBuf;
...
...
...
}
Is their anybody can help? Any comments are greatly appreciated!
Best Regards,
Wayne King,
17 May 2002
|
|
|
|
|
Inherit the two different classes from the same base class, and use virtual functions for the similar functions in the classes.
|
|
|
|
|
You can cast the void* to the pointer type you need.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks for mark & nish's kind reply.
|
|
|
|
|
I'v almost finished my first VC++ App, which is great.
But I've still got a big problem, which is not great.
The application logs data from the RS232 port over long periods of time. It displays this data in a list box, on a graph and in a 'LCD Meter' (which I draw). All in a modeless dialog box.
The problem is that if I leave it running for several hours, then the PC gradually gets more and more 'sluggish'. First you notice the mouse not responding very well and it takes ages to redraw the window. I've noticed that the clock in the corner of the screen starts to read about 2 hours slow, but when you reboot it is OK. In the end the whole system is too unresponsive to do anything so you have to reboot. Its an MDI application, written on VC++6, I'm testing it on a Win98 macine.
I'm guessing that I'm either running out of memory due to a memory leak (but I can't find one) or could I have too many messages for the system to cope with?
I just don't know where to start on this one. Any advice?
Thanks.
Ali
|
|
|
|
|
Sounds like you could possibly have a resource leak. On Win98, you have a diagnostic program called the resource meter (RSRCMTR.EXE). Run that program at the same time as your program is running, and it will tell you what your resource usage is.
Resource leaks occur if you do not release or delete any GDI resources (pens, brushes, fonts, cursors, icons, or bitmaps) you may have created.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
I've checked and checked my GDI resources, but it sounds like that is probably where the problem is, so I must be looking in the wrong place. I'll just have to look some more.
Thanks for the tip about the reasource meter, I'll go and look at that. It sounds really useful.
Thanks
Ali
|
|
|
|
|
Do you use GetDC() [or equivalents] at all?
I mistake I've made in the past was to have calls like this
SomeFunctionThatNeedsADC( GetDC() );
which allocates a DC, but never frees it, meaning you gradually run out of resources. The proper way is
CDC* pDC;
pDC = GetDC();
SomeFunctionThatNeedsADC( pDC );
ReleaseDC( pDC );
Also note that Windows2k/XP has much better resource handling to 9x so if you find your prog runs fine on 2k but gradually dies in 9x, then it probably is a resource problem
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
I think you can drop the idea of "too many messages". From your explanation it seems to be either memory (which is very easy to determine, I'm actually a bit surprised you haven't already done it) or some other resource(s) such as HANDLE's or some GDI (or even USER) objects.
Id start out by checking the graph and the LCD "meter" code to see if they aren't releasing something.
|
|
|
|
|
Thanks for the help, it sounds like a resurce problem. I've checked them over and over, but I must be missing something. I'll have another look.
Thanks
Ali
|
|
|
|
|
Another thought that struck me: Are you sending any messages from one control to another?
I've seen cases where, during handling of a window message, one control sends a message to another control when it instead should have posted it. This can lead to the second control creating another update message being sent from windows and...
Let's just say that the call stack can grow really deep.
|
|
|
|
|
Any body used boost library in VC++ ?? I am using it first time for exploring thread models but the VC++ compiler is giving Linker errors. It seems to me that Linker settings are not appropriate. If any one of you know the linker settings for boost library in VC++ 6.0 then please tell me. I've posted this problem in boost forums but no answer is arriving.
SattarA
|
|
|
|
|
I've used it a little bit. But I've only used the regex and lexical_cast stuff out of it, not the thread library. I have had no trouble using it in Visual C++ 6.0.
What sort of linker errors?
|
|
|
|
|
Is there any way to read Motorolla-style (Big Endian) file formats? The problem is that bytes ordering starts from high byte to low byte, unlike usual (for Windows) from low to high. E.g. if you will write DWORD type with value 1 into binary file using any file routines (MFC, API, whatever) you will see in the file such numbers: (in hex display)
01 00 00 00
When you'll read it, you will get you "1" back.
Now Motorolla style is vise versa:
00 00 00 01
I have such file (actually everyone has it - it is TrueType fonts) and I need to read the numbers in it correctly. Of course when I'm using CFile or file handle to read data, I get different numbers, since it reads it in Windows style
Any way to override it?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
We have done a lot of work rearranging bytes and words between big-endian and little-endian systems. Be careful, though, as usually the difference is not byte reversal, but word (i.e., 2-byte groups) reversal, depending on the processor. A fairly easy approach is to use a structure with high-word and low-word (or bytes, as needed). The read function can read file contents into the big-endian elements of the structure, and then a little-endian value can be constructed by combining those elements in reverse order.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|