|
Continuing with my theme of building useless applications to utilise controls and programming practices to get a fuller understanding of the whole VC++ thing, I have come up with the following idea, but no way to implement it.
Wanted to add some data to my application via a String Table (don't want to use the Registry or write to hidden files) for use in calculations. Also wanted to enable the user to be able to re-map this data to new values that would be available next time the application was started. Seems that according to MSDN I can't write data to String Tables and can't find anything in books, magazines or web sites to help me along.
Anyone have any idea how I can get this idea to work?
Must be possible as Shareware applications (no I am not writing one or trying to hack one) must store the registration key somewhere for the app to know it is registered. Or at least write something to the executable to show it is registered. Don't believe that it would be written to the Registry or a hidden file as this would be comparitively easy to find.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Do you think ? Writing to the executable or a file in the local directory would be easy. Writing a nonsensical ( or at least obsfucated ) value to an obscure part of the registry would be far harder to find. How about creating a file with an unusual name in the Windows system directory and storing info there ? I have shareware programs that I am *sure* write to my boot sector as they still know I have expired my trial after a reformat of the HDD !! ( I own them and get the message after reinstall prior to entering my key ).
I guess all of these methods are kind of user hostile, but I'm sure they are harder to find than modifying the actual executable - surely the first place a hacker wsould look.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
hi,
Yupe,... string table is a resource and is read-only. I dont think its possible (to my knowledge) to alter it afterwards.
Thats the reason people go for registry or flatfiles. Actually there is no harm in writing to registry if its not too much data. There are lots of apps. which write to registry extensively .. eg. (www.groove.net).
Shareware programs. have the algorithm inside for generating the appropriate key. You give the username and reg.code, now the program has a key generator inside and hence it generates the corresponding reg.code for this user and compares it with the one you have entered and hence it can recoginize them. Some, shareware store the password info in an encrypted form(using techniques like md5 message digest) and store them in the registry.
Cheers
Kannan
|
|
|
|
|
Hi, there.
I made a simple dialog-based app, I indend to add a CScrollView in that dialog, so that I can draw digrams in the View which is scrollable.
I searched solution for this case in books without success.
Could you please advise me?
Thanks a lot,
Don
|
|
|
|
|
Hello, the codegurus around the world.;)
Technically, this is possible since Paul Dilascia in MSDN Magazine posted the code
to show CHtmlView on the dialog based application about one year ago?
However, I forgot the back number, but try to find the article in MSDN home page.
http://msdn.microsoft.com/msdnmag
Also, I have read the article that someone succeeded in showing CView
on the dialog at the newsgroup of Microsoft.
Good luck.
-Masaaki Onishi-
|
|
|
|
|
Check out this one
http://www.microsoft.com/MSJ/0100/c++/c++0100.asp
Cheers
Kannan
|
|
|
|
|
How to make a new DSN during the instalation with InstallShield.
|
|
|
|
|
One method(and you didn't here it from me) is to create the appropriate registry entries under the HKLM(for System DSN) or HKCU(for User DSN) \Software\ODBC... look at existing registry keys for the appropriate values to use for your DSN. This isn't recommended because the registry may change and your install won't know it...
I'm not very familiar with Install Shield, but I do know that they allow you to create scripts that can call functions in dll's...
Try your hand at using the following ODBC API functions from your install shield script:
BOOL SQLConfigDataSource(
HWND hwndParent,
WORD fRequest,
LPCSTR lpszDriver,
LPCSTR lpszAttributes);
This function declaration and some of the #defines you'll need are in odbcinst.h. I can't remember which odbc dll it resides in, but I'm pretty sure it's on any machine that uses odbc.
This function will create an ODBC datasource, but it's behavior seems to vary from database to database, ie: if there's not enough data in your lpszAttributes parameter, a dialog may show prompting for the rest of the data, or the function may fail... depends on your database software...
Sample use(from docs):
SQL_RETCODE rc;
UCHAR *szDriver = "SQL Server";
UCHAR *szAttributes =
"DSN=MyDSN\0DESCRIPTION=SQLConfigDSN Sample\0"
"SERVER=MySQL\0ADDRESS=MyServer\0NETWORK=dbmssocn\0"
"DATABASE=pubs\0";
rc = SQLConfigDataSource(NULL, ODBC_ADD_DSN, szDriver, szAttributes);
-Good luck!
|
|
|
|
|
Hi,
I need to implement an ActiveX control text editor that draws a line at the end of each paragraph. I guess my two alternatives are either to start from scratch, or subclass something like the RichEdit control. I've had a look through various articles on subclassing but I haven't found anything that would give me a clue as to where to start for this kind of thing. Can anyone suggest something that I might take a look at to get started, or is this really a case of writing the whole thing from the ground up?
Thanks,
Richard.
|
|
|
|
|
I have a jpg loaded as IPicture. I was using it to show a photo. Now I want to save this photo as bitmap. How can i do this ? IPicture::SaveasFile does not seem to be useful.
Thanks
|
|
|
|
|
hi,
For storing the screen(client area) content as bitmap,there is a article in MSDN under ...
Platform SDK/Graphics And Multimedia Services/Windows GDI/Bitmaps/Using Bitmaps/Storing an Image
Hope this helps
Cheers
Kannan
|
|
|
|
|
I get this error message when I call a function in a MFC-Extension Dll (in Release-Mode) while debugging my MFC-Application.
If both (App and Dll) are in the same state (debug or release) everything is fine. I was able to reduce the problem to only a few lines of code. However I can not see what should be wrong in my program.
To reproduce this problem create an extension Dll and add the two files foo.h and foo.cpp
----- foo.h
IMP_EXP void Foo(CString& sVal);
----- foo.cpp
#include "stdafx.h"
#define IMP_EXP __declspec(dllexport)
#include "foo.h"
void Foo(CString& sVal)
{
sVal = "12345";
}
----- end of foo.cpp
Then create a MFC-App and include the following lines
----- any cpp-file of your app
#define IMP_EXP __declspec(dllimport)
#include "[Your Path]\Foo.h"
#pragma comment(lib, "[Your Dll-Name]")
void MyFunc()
{
CString str;
str.Empty();
Foo(str);
}
Thanks for your help
Rainer
|
|
|
|
|
Release and debug MFC use different and incompatible memory allocators. What you're seeing is a just result of that. You need to have all your modules built for the same mode (debug/release).
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Hello Mike,
thanks a lot for your answer.
So it looks like this is "by design" but not "by desire" . Because if you have several projects using some well tested "common dlls", you usually otherwise don't need these in debug and release mode, while debugging one of your apps.
Rainer
By the way: Thank you very much for your wonderfull tutorials ! ! ! !
|
|
|
|
|
Hi.
I have a chechbox to maik a dialog as always ontop.
But I do not know what properties or metod is for IT.
please Help me .
Thanks a lot.
|
|
|
|
|
Use SetWindowPos() with HWND_TOPMOST for the hwndInsertAfter parameter.
|
|
|
|
|
this is how I do it......
Add a control handler for when the Control is clicked
ON_BN_CLICKED(IDC_ALWAYSONTOP, OnAlwaysontop)
and the OnAlwaysontop as follows.....
void CSomeGenericDlg::OnAlwaysontop()
{
UpdateData(true);
if (m_AlwaysOnTop)
SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
else
SetWindowPos(&wndNoTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
There's probably better ways to do it, but this works, and it will set the "Always on Top" state immediately when the box is checked...
Liam O'Hagan
Senior Test Engineer
GLI Australia
www.gli.com.au
|
|
|
|
|
Hi!
i Hope that there anyone can help me.
i need to save images from the computer to a file in format jpg or gif
or in the worst case Bmp, or convert the Bmp to jpg later and svae it to file.
if you have any ideas how to do it plz answer .
pascal.
|
|
|
|
|
hi,
I'm afraid there are some licensing issues when it comes to saving it as GIF.
But for jpg you can go for Intel's Image processing library
For storing the screen content as bitmap,there is a article in MSDN under ...
Platform SDK/Graphics And Multimedia Services/Windows GDI/Bitmaps/Using Bitmaps/Storing an Image
or
you can try Smaller Animals Jpeg Class
Hope this helps
Cheers
Kannan
|
|
|
|
|
I haven't any formal Bitmap file,but only a short array,then
what can I do to create and show a Bitmap with 16 bit color depth?!
Please tell me in detail!
Thanks!
fly against the wind
|
|
|
|
|
The CBitmap create method takes a pointer to the data to initialise the bitmap as it's last parameter.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
How can i get IP address from my computer and server computer ?
Thanks for reply.
Hadi Rezaie
|
|
|
|
|
I am having a hard tym accessing the values
(array of strings) being returned by a function
in a DLL created in VB and place them in a VC++
combobox. The nearest I can get is dislay the
first characters of the strings in the array.
I need answers ASAP. Thanks.
(Here is the part of the code i am debugging ryt now)
void CUMNTestProgramDlg::OnDropdownCombo1()
{
HRESULT hresult;
CLSID clsid;
long lElements; // number of elements in the array
long iCount;
CString *pArrayElements; // pointer to the elements of the array
CoInitialize(NULL);
hresult=CLSIDFromProgID(OLESTR("MFCSUMNDLL.clsUMNDLL"),&clsid);
_clsUMNDLL *t;
hresult=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,__uuidof(_clsUMNDLL),(LPVOID *) &t);
if(FAILED(hresult))
{
AfxMessageBox("Creation Failed");
return;
}
// reset the contents of the combobox
m_cmbGroup.ResetContent();
pArrayElements = NULL;
t->ConnectForC();
// how many elements are there in the array
lElements = t->Groups()->rgsabound[0].cElements;
// locking the array before using its elements
hresult = SafeArrayLock(t->Groups());
// using the array
pArrayElements = (CString *) t->Groups()->pvData;
for (iCount=0; iCount<(lElements-2); iCount++)
m_cmbGroup.AddString((LPCTSTR) pArrayElements[iCount]);
// releasing the array
hresult = SafeArrayUnlock(t->Groups());
CoUninitialize();
}
=P
|
|
|
|
|
i think this may be your problem
// using the array
pArrayElements = (CString *) t->Groups()->pvData;
vb uses bstr's no? and they're unicode format chars no? maybe convert the bstr's to char strings before using them
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
hi. Iwant to know what commands is for access to windows registry
keys and its value.
help me pleas.
Iman Gh
Thanks a lot.
|
|
|
|