|
Hi all,
I has been created one MFC extension dll called SRecordset.dll that is
my .h file..
#pragma once<br />
#include <afxwin.h><br />
#include <afxdb.h><br />
<br />
class AFX_EXT_CLASS SRecordset : public CObject<br />
{<br />
DECLARE_SERIAL(SRecordset)<br />
<br />
<br />
public:<br />
SRecordset(void);<br />
<br />
public:<br />
~SRecordset(void);<br />
<br />
protected:<br />
CStringArray saDataContainer; <br />
short iNumFldCount; <br />
long iNumRec; <br />
int iRecCount; <br />
int iTotalSize; <br />
int iRecordState; <br />
int iLocalIndex; <br />
public:<br />
BOOL SSOpen(CDatabase &dbConnectedObj,CString sQuery); <br />
BOOL SSIsOpen(void); <br />
void SSClose(void); <br />
public:<br />
BOOL SSIsBOF(void); <br />
BOOL SSIsEOF(void); <br />
public:<br />
void SSGetFieldValue(int iIndex,CString &FldValue); <br />
short SSGetFieldCount(void); <br />
long SSGetRecordCount(void); <br />
long SSGetCurrentRecordCount(void); <br />
public:<br />
void SSMoveNext(void); <br />
void SSMovePrevious(void); <br />
void SSMoveFirst(void); <br />
void SSMoveLast(void); <br />
public:<br />
virtual void Serialize(CArchive& ar); <br />
};<br />
I could create dll successfully. But, it won't support to the client application meanwhile that will be thrown linker error only when i call the SSOpen(CDatabase &dbConnectedObj,CString sQuery) function during runtime
part of code of my client app...
void CtestingDlg::OnBnClickedOk()<br />
{<br />
<br />
<br />
CDatabase db;<br />
CString sIp,sDb,sPwd,sConn,sPort,sUn;<br />
sIp="192.168.2.17";<br />
sPort="5432";<br />
sPwd="fasp";<br />
<br />
<br />
try<br />
{ <br />
sConn = "DRIVER={PostgreSQL ANSI};SERVER=" + sIp + ";port=" + <br />
sPort + ";DATABASE=" + sPwd + ";UID=" + sPwd + ";PWD=" + sPwd + ";";<br />
db.OpenEx(sConn);<br />
AfxMessageBox("Success");<br />
}<br />
catch(CDBException *e)<br />
{<br />
MessageBox("Database Connection Refused."+e->m_strError,"DataBase <br />
Connection Error",MB_OK|MB_ICONERROR);<br />
e->Delete();<br />
<br />
}<br />
<br />
<br />
SRecordset set1;<br />
<br />
set1.SSOpen(db,"select name from master;");<br />
set1.SSGetFieldCount();<br />
set1.SSGetRecordCount();<br />
set1.SSClose();<br />
<br />
OnOK();<br />
}<br />
Error is.....
testingDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall SRecordset::SSOpen(class CDatabase &,class ATL::CStringT<char,class strtraitmfc_dll<char,class="" atl::chtraitscrt<char=""> > >)" (__imp_?SSOpen@SRecordset@@QAEHAAVCDatabase@@V?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) referenced in function __catch$?OnBnClickedOk@CtestingDlg@@QAEXXZ$0
could you help me please?
|
|
|
|
|
Are you linking with SRecordset.lib?
Best wishes,
Hans
|
|
|
|
|
yah i already done,but there is an error raised, when i calld only SSOpen() function not other function calls...
void CtestingDlg::OnBnClickedOk()<br />
{<br />
<br />
<br />
CDatabase db;<br />
CString sIp,sDb,sPwd,sConn,sPort,sUn;<br />
sIp="192.168.2.17";<br />
sPort="5432";<br />
sPwd="fasp";<br />
<br />
<br />
try<br />
{<br />
sConn = "DRIVER={PostgreSQL ANSI};SERVER=" + sIp + ";port=" +<br />
sPort + ";DATABASE=" + sPwd + ";UID=" + sPwd + "WD=" + sPwd + ";";<br />
db.OpenEx(sConn);<br />
AfxMessageBox("Success");<br />
}<br />
catch(CDBException *e)<br />
{<br />
MessageBox("Database Connection Refused."+e->m_strError,"DataBase<br />
Connection Error",MB_OK|MB_ICONERROR);<br />
e->Delete();<br />
<br />
}<br />
<br />
<br />
SRecordset set1;<br />
<br />
set1.SSOpen(db,"select name from master;");<br />
set1.SSGetFieldCount();<br />
set1.SSGetRecordCount();<br />
set1.SSClose();<br />
<br />
OnOK();<br />
}<br />
above the code thrown only one linker error for SSOpen() function...
please help me..
-- modified at 3:22 Thursday 10th May, 2007
|
|
|
|
|
You need to link to the lib file that is generated with your dll.
|
|
|
|
|
how to hide start menu.that was appeared when windows key is pressed.
|
|
|
|
|
Try a global hook.
Best wishes,
Hans
|
|
|
|
|
how to perform global hook.
|
|
|
|
|
First, take a look at this article.
Next, replace the msghook function with code similar to this:
static LRESULT CALLBACK msghook(int nCode, WPARAM wParam, LPARAM lParam)
{
KBDLLHOOKSTRUCT *pkbhs = (KBDLLHOOKSTRUCT *) lParam;
BOOL bControlKeyDown = 0;
switch (nCode)
{
case HC_ACTION:
{
if (pkbhs->vkCode == VK_LWIN || pkbhs->vkCode == VK_RWIN)
return 1;
break;
}
default:
break;
}
return CallNextHookEx (hHook, nCode, wParam, lParam);
}
|
|
|
|
|
Do you want to hide the start menu or disable the windows key on your keyboard?
|
|
|
|
|
hide the popup menu when i press window key
|
|
|
|
|
You want to hide the menu or do you want the menu to not appear? I am assuming the later is your query. Install a keyboard hook, as Hans Dietrich already said. Look at MSDN for SetWindowsHookEx() function. Remember that your hook procedure code has to reside in a DLL and then you need to load it from an executable.
|
|
|
|
|
brahmma wrote: You want to hide the menu or do you want the menu to not appear?
Can a hidden menu still appear, or is a menu that does not appear not considered hidden?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I wasn't clear. It should have been something like "Do you want to hide the menu that appears on key press, or do you want to suppress the key press event, so that the menu does not appear at all".
|
|
|
|
|
I got an usb radio and I want to keep playing music in a buffer so I can save it later. How can I do it?
|
|
|
|
|
Does the radio have a record feature?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Can't you use the windows sound panel/mixer to re-route the audio to a file ?
|
|
|
|
|
No record feature. I want to write a program to save audio but I don know about buffers. Is there any sample source code to record a playing audio?
|
|
|
|
|
Search in MSDN (or google the entire internet) for waveInOpen or waveInAddBuffer - these are some of the SDK-level Windows Multimedia functions you could use to handle.
An approach I have used in the past is to allocate a set of buffers in memory (using malloc - I code in C!) then open the wave device, and one by one do waveInAddBuffer to the audio device, and processing each buffer (copy it to another area in memory) whenever it is full and do waveInAddBuffer again. I only stored a few minutes, so I could replay a short section from PC memory, but you could write them to a file on the hard disk instead.
|
|
|
|
|
I had a look for a small project I wrote a few years back, but could only find a very early version that doesn't do anything.
The project recording and play using Waveform audio interface http://www.codeproject.com/useritems/julienT.asp[^] appears to do what you want, but the article doesn't really describe anything. The source code looks quite well commented. Try starting here.
If the above article doesn't help, search codeproject articles for waveInOpen, and have a look at the other sample projects that are shown.
Once you've had a look at the sample code on CodeProject, try to ask about specific problems you have.
|
|
|
|
|
hi,
I am using CApplication,CWorksheets,CWorkSheet classes from VC++, I need to copy a sheet into the same WorkBook but i dont know how.
Thanks
|
|
|
|
|
Have you looked at the documentation for the Excel Object Model?
led mike
|
|
|
|
|
Yes,
but all the information is about C# or VB, nothing about C++ using classes CWorksheet,CWorkBook...
I think i must use CWorksheet.Copy (Or CWorkSheets.Copy) function, but i dont now what parameters i need to send. (It ask for two Variants).
|
|
|
|
|
_Nanon_ wrote: but all the information is about C# or VB
Well, the interfaces used and the flow of how to accomplish something is the same no matter what language the client is implemented in.
If you find a good example of what you want to do, but it's not written in the language you'd prefer, I suggest you study the flow and the function arguments anyway. It would get you a picture of what you need to do and in what order to do it.
You might even get a little understanding of the other language as well while you're at it and that must be a good thing, right?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I found examples in VB, but the problem it is not th algorithm, the problem is where can i found information about arguments for VC++, because it is different between C#,C++ and VB (I think, but i am not sure) to use the CWorkSheet (CWorkBook....)
I am tried:
CWorkSheet MYSHEET.copy(_variant_t(SHEET),_variant_t(SHEET))
CWorkSheet MYSHEET.copy(_variant_t(NUMBER),_variant_t(NUMBER))
CWorkSheet MYSHEET.copy(_variant_t(SHEET NAME),_variant_t(SHEET NAME))
CWorkSheets MYSHEETS.copy(_variant_t(SHEET),_variant_t(SHEET))
CWorkSheets MYSHEETS.copy(_variant_t(NUMBER),_variant_t(NUMBER))
CWorkSheets MYSHEETS.copy(_variant_t(SHEET NAME),_variant_t(SHEET NAME))
|
|
|
|
|
_Nanon_ wrote: but i dont now what parameters i need to send. (It ask for two Variants).
Yes they hide that information in the Documentation[^]
led mike
|
|
|
|