|
Hi chaps,
Just been getting into a bit of ADO database programming and have been able to connect to a database on the same computer that my program is running on. All the resources I have read seem not to mention how to access a SQL db on a network or on a server, say the other side of the world.
The connection part of the program (in the document class) goes along these lines:
m_pConnection->Open(_bstr_t(L"Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\\Program Files\\Microsoft Visual Studio\\VCDb.mdb;"),
_bstr_t(L""),
_bstr_t(L""),
adModeUnknown);
In this example I am connecting to a Microsoft Access DB. But supposing I want to connect to a MySQL DB running on a Linux Machine, or just simply another SQL DB on a Microsoft server ?
Apologies for the stupidity, but I am kind of new to this are of programming and am getting frustrated with poor recourses I have found.
Any help will greatly appreciated
Graham
|
|
|
|
|
May be this[^] will help
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Is there a way to monitor if the USB port on system has had its connector removed?
|
|
|
|
|
I'm trying to draw a bitmap with a highlighted effect with the following code:
HBRUSH hSelBrush = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
DrawState(hDC, hSelBrush, NULL, MAKELPARAM(hBmp, 0), 0, x, y, ImgWidth, ImgHeight, DST_BITMAP | DSS_UNION);
DeleteObject(hSelBrush);
The problem is that it doesn't do it on the white pixels. Is there any way to fix it?
-thanks
|
|
|
|
|
Hi!
I would like to change the cursor of the entire system temporarily, so I cannot use SetSystemCursor. My goal is to hide the cursor, so I can either hide it or change it to a blank one that I load. ShowCursor(FALSE) seems to only apply to the current window.
Any help would be appreciated.
|
|
|
|
|
debacler wrote:
ShowCursor(FALSE) seems to only apply to the current window.
That's because the cursor is a shared resource. In Win32 one app isn't allowed to control such a resource since it would affect all apps running on the system.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
You can change system wide cursor using ::SetSystemCursor() API. Then what else the problem u have. Just create a blank cursor in ur resource editor( here IDC_CURSOR1) Load it... Create another one cursor which is having ur system cursor ( here IDC_CURSOR2).
void CTestDlg::OnHideCursor()
{
HCURSOR h1 = AfxGetApp( ) -> LoadCursor ( IDC_CURSOR1 ) ;// User your blank cursor here
HCURSOR h2 = CopyCursor ( h1 ) ;
::SetSystemCursor ( h2, OCR_NORMAL ) ;
}
void CTestDlg::OnShowCursor()
{
HCURSOR h1 = AfxGetApp( ) -> LoadCursor ( IDC_CURSOR2 ) ;// User your system cursor here
HCURSOR h2 = CopyCursor ( h1 ) ;
::SetSystemCursor ( h2, OCR_NORMAL ) ;
}
Thatzaal..;)
loveablevirus
|
|
|
|
|
Thanks
The hide cursor code works great, but when I show the cursor again, I want it to be the user's cursor, not one stored in my resources. So instead of AfxGetApp()->LoadCursor(...) for the show function, I'm trying this:
HCURSOR h1=LoadCursor(0,IDC_ARROW);<br />
HCURSOR h2=CopyCursor(h1); <br />
::SetSystemCursor(h2,OCR_NORMAL);
Which doesn't work, and I have to restore the cursor otherwise. How can I restore the original cursor?
|
|
|
|
|
Ya.. I dOno why its not working... but there is another one solution to restore the system cursor (without using ur resource). Declare a HCURSOR m_h; member variable to ur dlg class.
void CTestDlg::OnHideCursor()
{
m_h=CopyCursor(LoadCursor(NULL,IDC_ARROW)); // Store system cursor in m_h
HCURSOR h1 = AfxGetApp( ) -> LoadCursor ( IDC_CURSOR1 ) ; // Load ur cursor
::SetSystemCursor ( h1, OCR_NORMAL ) ; // Change system cursor with urs
}
void CTestDlg::OnShowCursor()
{
::SetSystemCursor ( m_h, OCR_NORMAL ) ; // Restore system cursor from m_h
}
It is working well for me. Try urself.
Hava nice day;)
with regards
loveablevirus
|
|
|
|
|
That works wonderfully! Thank you very much! I tried doing something similar but mine involved copy cursor and it didn't work right, so simple and elegent.
|
|
|
|
|
I am writing a web download installer and need to make it as small as possible. A lot of MFC is a black box to me so I am not sure which pieces I can hack out and still expect the program to behave as expected.
It is currently 210 KB and I only wrote a thousand or so lines of source code (including comments). There is only 1 window and it is a dialog-based app. It does use the file open common dialog box and afxinet.h
Thanks!
//placeholder for witty verbiage
|
|
|
|
|
lets see... you could use an executable compressor like UPX for instance. Once you compile it run upx and compress your executable. get it here
|
|
|
|
|
sorry about the link... get it at www.upx.sourceforge.net
|
|
|
|
|
|
Shrinking the size of an MFC app in VC++ 7.x is difficult. In VC++ 6.0, you could get it down to about 160k but not much more than that.
Since it's dialog based, I'd consider just converting it to a standard windows app and taking the parts of afxinet.h that you need.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If you want to keep it small then I think you should avoid using MFC.... write a simple application without them...
Did you compiled your app using the static MFC library version? You cannot hope that who will use your installed has already the MFC Dlls
|
|
|
|
|
Did you look at this?[^]
---
"Man will never be free until the last king is strangled with the entrails of the last priest". -- Denis Diderot
|
|
|
|
|
I've looked all over this site, and googled it but I can't seem to get the count function to work. here's what I have:
int iCount = count(vecWords.begin(),vecWords.end(),sWord)
where sWord is a struct variable of the type the vector is holding. I even try to hard-code a 1 or any other type of variable in there and I keep getting the same error message:
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::allocator<_Ty>::value_type' (or there is no acceptable conversion)
Can anyone help? Thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Have you defined the == operator for the type used as your vector element?
|
|
|
|
|
NO, I haven't. thanks!! but can I define an '==' for a struct?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
bdiamond wrote:
but can I define an '==' for a struct?
Sure:
struct foo
{
int x;
bool operator== ( const foo& rhs ) const
{
return x == rhs.x;
}
};
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
thanks; I knew how to make the overloaded operator, I'm just not that familiar with structs.;)
If it's broken, I probably did it
bdiamond
|
|
|
|
|
in C++, struct s are only classes whose default attribute is public .
of course you can, and better, you must ! (in your case, if you want to use this function)
TOXCCT >>> GEII power
|
|
|
|
|
thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
hi,
I'm trying to write my own mp3 player using DShow, since this point I've been able to let mp3 start,pause,stop and get duration of song, but I don't know where to start from for showing how times goes forward, need I to use threads or DirectShow provides a simple callback function?
thanks a lot
Paolo
|
|
|
|