|
Thanks
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
It's slightly obscure, but you can use the following to tell the linker to add a lib file:
#ifdef MY_SHINY_FEATURE
#pragma comment(lib, "shinylib")
#endif // MY_SHINY_FEATURE
...
void DoSomethingMaybe ()
{
#ifdef MY_SHINY_FEATURE
shinyfunction ();
#endif // MY_SHINY_FEATURE
}
Iain.
|
|
|
|
|
Thanks!
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi Guys,
I have briefed on the current implementation of my application which is used to detect mobile data cards.
The application consists of an Main module and seperate dlls modules, one dll for each mobile data card that my application wants to detect.
This mobile data card dlls contain unique device info like the registry name/path that is used to uniquely identify an card from other cards hardcoded in them.
Assume 3 device dlls whose class goes by the name CMobileData_A and CMobileData_B. These class are derived from an base class CMobileData as indicated by the code snippet below.
class CMobileData
{
public:
bool DriverInstalled();
bool DevicePresent();
}
class CMobileData_A: public CMobileData
{
public:
bool DriverInstalled();
bool DevicePresent();
}
class CMobileData_B: public CMobileData
{
public:
bool DriverInstalled();
bool DevicePresent();
}
I have given 2 methods to illustrate the current implementation.
When application is started, the main module contains reads an xml file which contains the list of MobileData cards that it has to load(dll names of the different Mobile Data card dlls).
Each dll that is mentioned in the xml is dynamically loaded and it's instance created and the pointer to the instance stored in another list(say list m_DllsInstance) for all the dlls present in the xml.
Now the methods DriverInstalled() and DevicePresent() of all the dlls are called using their respective class instance using the list m_DllsInstance one after the other.
When the nth item in the m_DllsInstance list which refers to the CMobileData_A class instance, the 2 methods would be called. Only for this particular call will these 2 methods return success as
this is the currently used device. Hence my main application will contain the logic to figure out that this is the device in use there by detecting the card.
This application works fine.
But the problem here is that the current implementation will require a seperate dll for each mobile data card and this card will contain all the unique characteristices of the card.
I want the change the implementation such that there is a need for a single dll.
This dll inturn could refer to an external configurable file (say an xml file) which could contain info unique to each mobile data card.
The implementation should take these unqiue characteristics from the xml file and pass these info to these 2 methods.
The 2 methods instead of having the hardcoded unique device info, should recieve the requied info as a parameter.
Any guidance as to how i go about achieving this implementation will be of great help.
|
|
|
|
|
I am trying to create a toolbar in CView.The toolbar is getting created,but it is not visible.
Can anyone help me.
Thanks in advance
|
|
|
|
|
Hi guys!
*need 2 register an ocx programatically
any help's appreciated..
thank's in advance
|
|
|
|
|
Hey man!
Can you write with a bigger/brighter font?
I'm unable to see your request...
BTW:
- Load the component's
DLL (i.e. the .ocx file) - Call
DllRegisterServer [^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Hi All
I am geting error when i am useing COleDataObject.I got some example code from net.It's very help full for me but when i am use the code then i am geting error.
COleDataObject odj1;
if( odj1.AttachClipboard() )
{
if( odj1.IsDataAvailable( CF_HDROP ) )
{
STGMEDIUM StgMed;
FORMATETC fmte = { CF_HDROP,
(DVTARGETDEVICE FAR *)NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL };
if( odj1.GetData( CF_HDROP, &StgMed, &fmte ) )
{
HDROP hDrop = (HDROP)StgMed.hGlobal;
UINT cFiles = ::DragQueryFile(hDrop, (UINT)-1, NULL, 0);
CString szText;
char szFile[MAX_PATH];
szText="";
for( UINT count = 0; count < cFiles; count++ )
{
::DragQueryFile(hDrop, count, szFile, sizeof(szFile));
szText += szFile;
szText += "\r\n";
}
m_pRich->ReplaceSel(szText);
if (StgMed.pUnkForRelease)
{
StgMed.pUnkForRelease->Release();
}
else
{
::GlobalFree(StgMed.hGlobal);
}
return;
}
}
}
error geting
error C2079: 'odj1' uses undefined class 'COleDataObject'
error C2228: left of '.AttachClipboard' must have class/struct/union
error C2228: left of '.IsDataAvailable' must have class/struct/union
error C2228: left of '.GetData' must have class/struct/union
Plz help me
|
|
|
|
|
|
How can I extract images of a website like some programs is it possible on the c++? if yes how?
|
|
|
|
|
You first need to get access to the HTML source that has currently been loaded.
This differs from browser to browser.
In IE you can write a BHO.
In Mozilla based browsers you can like Firefox and Netscape you can write an extension.
Then you can use HTMLDOM/Javascript/XPComm to access all the IMG tags to fetch the images.
«_Superman_»
|
|
|
|
|
If you know the URL of the image, try URLDownloadToFile() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i want to know how to call a DLL
and what is the difference between both
1.cocreate
2.Import dll
Thank you...
vikas da
|
|
|
|
|
tasumisra wrote: i want to know how to call a DLL
You don't call a dll. You first load the dll and when this is succesfull you can retrieve the addresses of functions in the dll and call those functions.
|
|
|
|
|
|
tasumisra wrote: 1.cocreate
Do you mean CoCreateInstance [^]?
BTW: What about DLL 's documentation [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
There are two methods generally.
One:Dynamic load DLL
HINSTANCE hInst;
//DLL2.dll must in current directory.
//Implement on a button clicked event.
hInst=LoadLibrary("DLL2.dll");
typedef int (*ADDPROC) (int a,int b);
ADDPROC add=(ADDPROC)GetProcAddress(hInst,"Add");
if(!add)
{
MessageBox("Failed to get address!");
return;
}
int ret=add(5,3);
CString str;
str.Format("%d",ret);
MessageBox(str);
Two:Static load DLL
First place DLL2.dll and DLL2.lib into current directory,
then set project/settings/Link to load DLL2.lib
_declspec(dllimport) int add(int a,int b);
void CDLL2TestDlg::OnButton1()
{
int a=add(5,5);//use this method from dll
}
studing is processing in this life.
|
|
|
|
|
what does the declaration (:8, :3, :1, etc.,) mean in the folowing struct?
struct CELL {
unsigned short character : 8;
unsigned short foreground : 3;
unsigned short intensity : 1;
unsigned short background : 3;
unsigned short blink : 1;
} screen[25][80];
|
|
|
|
|
character is an unsigned short value but will occupy only 8 bits and not 2 bytes.
foreground is an unsigned short value but will occupy only 3 bits and not 2 bytes.
Similarly other fields of the structure.
For example if valid values for intensity are only 0 and 1, you only need 1 bit to represent that.
That is the idea here.
«_Superman_»
|
|
|
|
|
Thanks for your reply.
In case the size exceeds the predefined size what will happen?
|
|
|
|
|
If value cannot fit into the number of bits allocated, it will then overflow to the next field.
It is up to the application to limit that.
«_Superman_»
modified on Wednesday, January 7, 2009 3:11 AM
|
|
|
|
|
Superman's answer is incorrect - the behaviour on assignment of a value that cannot be held in the bit-field is implementation (i.e. compiler) dependent - that's what the C++ Standard says (section 4.7p3), anyway, and I suspect the C standard will be much the same.
Certainly, for Microsoft C/C++, values are truncated to what will fit in the bit-field. Consider this code:
#include <stdio.h>
struct X
{
unsigned int a : 3;
unsigned int b : 3;
};
int main(int argc, char** argv)
{
{
struct X x = {0};
x.a = 15;
printf("x.a = %d, x.b = %d\n", (int)x.a, (int)x.b);
}
{
struct X x = {0};
x.b = 15;
printf("x.a = %d, x.b = %d\n", (int)x.a, (int)x.b);
}
return 0;
} This produces the following output when compiled as C or C++:
x.a = 7, x.b = 0
x.a = 0, x.b = 7
|
|
|
|
|
|
KASR1 wrote: what does the declaration (:8, :3, :1, etc.,) mean in the folowing struct?
They are the number of bits assigned to each field. The author wanted to store the data in 2 bytes (unsigned short) and specify names for each set of bits within those bytes. This is normally considered non-portable (but legal) C-Code. There are other more portatable ways of doing the same thing, but they require a little more work by the programmer.
Note that they defined exactly 16-bits; if they had specified just one more bit, it would changed the memory block size to 32-bits (unsigned int = 4 bytes on 32-bit compilers) unless some compiler specific flag was set to compact it to single by boundries.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|