|
I know wireless is a big topic these days, so this might interest some of you. To send SMS wireless messages to cell phones and pagers from a variety of Visual C++ applications, you might want to try our company Simplewire. There is a Developer Program at http://devprogram.simplewire.com or just go to http://www.simplewire.com.
We have SMS Software Development Kits in many versions, including a very easy to use ActiveX version. The ActiveX SMS SDK will run inside ASP pages, Visual C++ Projects, Internet Explorer, Visual Basic, Delphi, Powerbuilder, Microsoft Office, or any other environment that support ActiveX COM objects.
Then you can use Simplewire's network to connect to hundreds of networks. Hope this may help some of you who are looking to get into wireless. The Developer Program is completely free, so feel free to try it.
I've included a little source code so you can get a feel for how things embed into your app with the component.
#include <iostream.h>
#import "SimplewireSMS.tlb"
int main(int argc, char* argv[])
{
// Initialize COM
CoInitialize(NULL);
// Instantiate SMS Object
Simplewire::ISMSPtr pISMS;
pISMS.CreateInstance("Simplewire.SMS");
// Subscriber Settings
pISMS->PutSubscriberID("123-456-789-12345");
pISMS->PutSubscriberPassword("Password Goes Here");
// Message Settings
pISMS->PutMsgPin("+1 100 510 1234");
pISMS->PutMsgFrom("Demo");
pISMS->PutMsgCallback("+1 100 555 1212");
pISMS->PutMsgText("Hello World From Simplewire!");
// Send Message
cout << "Sending message to Simplewire..." << endl;
pISMS->MsgSend();
// Check For Errors
if(pISMS->GetSuccess())
{
cout << "Message was sent!" << endl;
}
else
{
cout << "Message was not sent!" << endl;
cout << "Error Code: " << pISMS->GetErrorCode() << endl;
cout << "Error Desc: " << pISMS->GetErrorDesc() << endl;
}
// Cleanup
pISMS.Release();
CoUninitialize();
return 0;
}
Hoping this helps!
Bob
|
|
|
|
|
How to rebuild icons cache in WIN98?
|
|
|
|
|
Can I use into ATL project in dll that I wrote in mfc (by attach the lib file and the header file of that to the ATL project) ?
So that my ATL will import functions from this mfc dll.
because I need to provide this dll for delphi and I dont know how to write all this project in ATL .
So the dll that will get from this ATL will be wrap to the mfc dll.;)
What do you say , Christian Graus
|
|
|
|
|
Yes, but when you are creating the ATL Project you need to check MFC Support....
You will have no problem with that.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
|
Don't mention it....
We are for help you...
Carlos Antollini.
|
|
|
|
|
Well, I want to use my mfc dll <mydll> in ATL .I do so :
1. open project: ATL COM Wizard.<myatl> [DLL] [MFC Support]
2. insert to the library that created the file : MyDll.dll
and attach to the ATL project the files : MyDll.h , MyDll.lib
-----------------------------------------------------------------
now I want to insert to my ATL the bellow code lines (such as I maked successfully at mfc client program):
#include "MyDll.h"
extern __declspec(dllexport)int func(LPSTR str)
{
MyDialogObject dlg;
dlg.DoModal();
.............
.............
}
--------------------------------------------------------------------
Is this the right way to write it in the ATL ?
Where have I put that code ?(In the cpp file ?)
--------------------------------------------------------------------
I wiil be greatful if you will answer me .
|
|
|
|
|
In your ATL DLL project,
Insert->New Class
ClassType = ATLClass
Name = CMyDialogWrapper
InterfaceType = Dual
NumberOfInterfaces = 1
Hit OK
In ClassView find the IMyDialogWrapper under CMyDialogWrapper
Right mouse, AddMethod
MethodName ShowDialog
Hit OK
In the generated function
STDMETHODIMP CMyClassWrapper::ShowDialog()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
m_dlg.DoModal();
return S_OK;
}
Add m_dlg to the CMyClassWrapper class defintion
Hope this helps,
Michael
|
|
|
|
|
Thanks ! I succesed do it through your excellent tutorial !
it passed compilation succesfully !
Now I need test it .
Can you explain me how to build client program (in mfc).
Which files I need to attach?
Is it enough to write so:
------------------------------------------------------------
CMyDialogWrapper dlg;
dlg.ShowDialog();
------------------------------------------------------------
Please ! Please ! Please ! It is very urgent !!!
|
|
|
|
|
I've done a plugin based application where the core of the program is in an .exe file and the plugin engine in a .dll. The plugins themselves are on another folder (see below). Last week I made a new plugin which use the zlib.dll the read zip files.
So here's the linkage:
- .exe load plugin engine .dll
- plugin engine .dll load the unzip plugin
- the unzip plugin load the zlib.dll (this is dynamic linking)
and here are the 2 folders:
appplication.exe
plugin engine.dll
|___plugins folder with...
unzip plugin.dll (compiled with zlib.lib)
zlib.dll
Unfortunaltely I found that to make this work I have to put the zlib.dll on the application root folder.
Can someone tell me how what I should do to make this work with the zlib.dll in the plugins folder instead ?
Yarp
|
|
|
|
|
I suppose you could try to set the current directory to the plugin directory before loading a plugin DLL, then restore the previous current dir.
According to MSDN, about LoadLibrary(), the current directory is searched also, but since zlib.dll is referenced by another module and not manually loaded I'm not sure this will work.
Solution, as always, is trying
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
That's it, it works fine.
...As always simple is effective.
Thank you for the advice, it looks better that way.
Yarp
|
|
|
|
|
Whenever I run my app under windows 98 (debug build), I get a runtime error and the pleasant option of either closing the app or debugging it. I hit debug and the OS freezes.
If I run the same app under the debugger (no breakpoints), it runs fine. However, the output window does print the following message when the app has exited
First-chance exception in myapp.exe (mydll.DLL): 0xC0000005: Access Violation
Does anyone have any pointers on how I might track this one down?
James Spibey
Well cover me in honey and throw me to the lesbians!
|
|
|
|
|
Answered my own question, I'm afraid. This thread is the place to look.
James Spibey
Well cover me in honey and throw me to the lesbians!
|
|
|
|
|
Hey folks,
I'm writing some code that uses structures to define which functions to use on which data. I've written a little example here that would give you an idea of what I'm trying to do in hopes that you could point me in the right direction.
typedef BOOL (*POPULATEPROC) ( VOID* pbuffer, USHORT data );
typedef struct FIELDDATAmd
{
CHAR name[40];
USHORT width;
POPULATEPROC popproc; // Function called to initialize this field
}FIELD_DATA, *PFIELD_DATA;
FIELD_DATA My_Data ( ("Device Name, 20, Populate_Devicename ),
("Model Name, 25, Populate_Modelname ) );
Now, for each of the fields in My_Data, I have specified a function which will be used for population. I've implemented this type of thing many times in Win32 without any problems.
My_Data[2].popproc ( "text", 20 ); ( this runs my Populate_Modelname function )
Now... question is: ... If I wanted to do this in C++, how would I go about doing it?
I have a class called CTestDlg, which has a FIELD_DATA structure, which has fields and pointers to functions. How do I set this up such that the functions it points to are member functions for my CTestDlg class?
I've tried implementing it like so:
FIELD_DATA My_Data ( ("Device Name, 20, CTestDlg::Populate_Devicename ),
("Model Name, 25, CTestDlg::Populate_Modelname ) );
And no luck... anyone have any ideas?
Mike, doner@obtain.com
|
|
|
|
|
The problem is that your methods CTestDlg::Populate_Devicename and CTestDlg::Populate_Modelname are not POPULATEPROC s. The methods accept a "hidden" additional parameter, namely the this pointer. Otherwise, how could your program possibly know which CTestDlg instance to call the methods upon just from the information stored in a FIELD_DATA struct?
This question is very frequently asked here and the Mike Dunn's C++ FAQ addresses it, have a look there.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín is right. If you declare the dialog members as static to change them from __thiscall to __cdecl , then something like this will work:
#include <iostream>
#include <windows.h>
using namespace std;
typedef BOOL (*POPULATEPROC) ( char* pbuffer, USHORT data );
class CIWishIWasADialog {
public:
CIWishIWasADialog();
~CIWishIWasADialog();
static BOOL Populate_Devicename( char* pbuffer, USHORT data ) {
cout << "We're in Populate_Devicename - " << pbuffer << endl;
return TRUE;
}
static BOOL Populate_Modelname( char* pbuffer, USHORT data ) {
cout << "We're in Populate_Modelname - " << pbuffer << endl;
return TRUE;
}
};
struct FIELD_DATA
{
CHAR name[40];
USHORT width;
POPULATEPROC popproc;
};
FIELD_DATA My_Data[] = {{"Device Name", 20, CIWishIWasADialog::Populate_Devicename},
{"Model Name", 25, CIWishIWasADialog::Populate_Modelname }};
int main(int argc, char* argv[])
{
My_Data[0].popproc("Honda",0);
My_Data[1].popproc("Accord",0);
{
int x;
cin >> x;
}
return 0;
}
But now you have a bit of a problem in that the static members don't have access to other members (i.e. don't have an implicit this pointer).
Hmmm... what if you had a series of windows messages defined - like UWM_POPULATE_MODELNAME - then you could post a message to the dialog instead of calling a member directly. You could then just use the message IDs in your structs as well, and wouldn't have to worry about the dialog::function name.
|
|
|
|
|
Thanks for the info, I managed to get it to work using the C++ Faq idea..
Created a static function, I passed "this" in as one of the params, then casted it to the dlgtype... works.
Much appreciated.
Mike.
|
|
|
|
|
Lame.
I'm trying to use ShGetFolderPath to figure out the location of the "My Documents" forlder and MSDN claims that I need ShFolder.h and ShFolder.lib. Overlooking the fact that all other shell related files begin with "SHL" and not just "SH", when I included them, my compiler (VC6 no SPs) claims not to be able to locate them...
I looked for them myself and lo and behold, they are missing. I seem to have every other file, just not the one I want.
So, I have two questions:
1. Do the ShFolder.* files exist and for some god-foraken reason I don't have them or are they part of mythology?
2. Is there another API or way to find the "My Documents" folder that does not include searching the hard drive for it?
Thanks in advance,
The Arabundi
---
PAGE FAULT: Please insert "Swap File Disk 2" in drive and press any key to continue
|
|
|
|
|
Hello, the codegurus around the world.;)
Probably, you need Microsoft Platform SDK.
I checked ShFolder.h in include of MPSDK, and to be sure, it has.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Thank you
---
PAGE FAULT: Please insert "Swap File Disk 2" in drive and press any key to continue
|
|
|
|
|
Hi to anyone,
I've a some problems on using ReadFile and WriteFile API functions.
I'm usinge these API on a function that will merge multiple files into one file.
The problem is that any nul(0x00) character will be converted (after WriteFile() call) to sp(0x20).
I've used a 'BYTE buf[4096]' buffer to load into datas and also changed this buffer to an 'LPVOID lpbuf' dinamicaly allocated with (HeapAlloc() function), but never changed.
Can anyone tell me my these conversions?
What I'm doing so wrong?
thank you in advance.
"Take time to think, it is the source of power"
|
|
|
|
|
I believe you have to open the FILE stream as binary.(if you are not all ready doing that) That way everything is treated as raw binary data.
erik
|
|
|
|
|
Correct, but I opens all files with CreateFile(...) API call.
How can I specify binary mode instead of text mode?
Thank you in advance
"Take time to think, it is the source of power"
|
|
|
|
|
Excuse me, but I've solved my problem.
I was causing the conversion with my code.
Thanks for your time
max
"Take time to think, it is the source of power"
|
|
|
|