|
I've tried to used this article http://www.codeproject.com/csharp/CsAutomateWord.asp?target=Word to create a character sheet.
I have a CCharacter class, that contains all information about a character, and I want to generate a MS Word document with these information.
So I've created .dot document, with thinks like
Name _Name_ Age _Age_
in arrays (I've tried also without the array, directly in the text). _XXX_ is code that I will use for replacement.
Now, to the code:
// Create a Word application
Word.ApplicationClass vk_word_app = new Word.ApplicationClass();
// Open the .dot
object FileName =Directory.GetCurrentDirectory()+"\\Models\\Sheet.dot";
Word.Document vk_my_doc = vk_word_app.Documents.Open(...
// Create a new document
Word.Document vk_new_doc = vk_word_app.Documents.Add((...
// Copy the .dot into the new document
vk_my_doc.Select();
vk_word_app.Selection.Copy();
vk_new_doc.Select();
vk_word_app.Selection.PasteAndFormat(Word.WdRecoveryType.wdPasteDefault);
// close the .dot
vk_my_doc.Close( ref vk_false, ref vk_missing, ref vk_missing );
All the previous steps work. I get a new document, build from my template.
Now, I'd like to fill it with actual information. So I do this
// Select the new doc
vk_new_doc.Select();
// Define some variable
object vk_false = false;
object vk_true = true;
object vk_num = Word.WdFindWrap.wdFindStop;
object vk_find = "_Nom_";
object vk_replaceWith = Name_Familly; // This one is a member of CCharacter class
object vk_replace = Word.WdReplace.wdReplaceOne;
// Try to replace the text
vk_word_app.Selection.Find.Execute( ref vk_find,
ref vk_false, ref vk_false,
ref vk_false, ref vk_false, ref vk_false, ref vk_true,
ref vk_num, ref vk_false,
ref vk_replaceWith, ref vk_replace, ref vk_false,
ref vk_false, ref vk_false, ref vk_false );
And... it doesn't work.
I got this error:
System.Runtime.InteropServices.COMException (0x800706F7): Le relais a reçu des données incorrectes.
at Word.Find.Execute(Object& FindText, Object& MatchCase, Object& MatchWholeWord, Object& MatchWildcards, Object& MatchSoundsLike, Object& MatchAllWordForms, Object& Forward, Object& Wrap, Object& Format, Object& ReplaceWith, Object& Replace, Object& MatchKashida, Object& MatchDiacritics, Object& MatchAlefHamza, Object& MatchControl)
My form close, the word doc stays opened.
"Le relais a reçu des données incorrectes" would translate as "incorrect data received".
Any idea of a way to solve this would be greatly welcomed!
|
|
|
|
|
I want to figure out how exaxtly Remember my password and username is implemented in messengers or any desktop application say Yahoo messenger.
|
|
|
|
|
There is no concrete way. Remember that any key you use to encrypt such information can relatively easily be extracted and used to decrypt passwords, so don't do that.
A good mechanism would be to hash the password using MD5 or SHA1 (both good hash algorithms) before transmitting across the 'net or storing. These two algorithms are mathematically proven to be irreversable. If the user has the "Remember Password" option checked, then read the value from a file or the registry - which is the password hash - and transmit it without hashing it again (which is also hingent on whether "Remember Password" is checked). This is pretty good for secure storage, as well as somewhat secure transmission.
On the server side, you simply store the password hash and compare the hash sent by the user with the hash stored in the database (or whatever).
One warning, though - sending just the hash is subject to replay attacks. If someone intercepts that hash, they merely have to send it with some program they could right and get access to the user's information. Instead, before sending the hash, request another hash that is used to hash the password hash, but that hash should be reversible. When it gets to the server, extract the original password hash and compare. This is known as a challenge-response mechanism, and there's several ways to do it. Trying googling for more details. Note: digest authentication in web browsers use this mechanism, so you could start there if you like. There is an RFC for it, so try looking at IETF RFC Page[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
That was highly Fundu stuff. Need time to digest it. Then I will get back to U.
Thanx
|
|
|
|
|
I want to develop a application which will connect me directly to yahoo messenger window. i.e entering username and password in Login window will be handled by my application. Don't know how to do it?
|
|
|
|
|
I am not familiar with the workings of the Yahoo messenger and its server.
Sounds like you want to develop a custom client. One solution is winsock. Just look up the protocol that the message server understands.
Kuphryn
|
|
|
|
|
That is the problem I am facing. There are no standard protocols. I just want to some how write in the Edit Boxes and I am done with it
|
|
|
|
|
hi there..
thanks for your time..
i needed to know if its possible to know if a control is UI Activated already or not? and secondly which function is called when a control is UI DeActivated?
regards
safee
|
|
|
|
|
|
Hi there
Using the API GetAmbientUserMode() , this tells whether the container is in run-mode (TRUE) or design-mode (FALSE).
regards
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I'm quite new to VC++ programming. I need to develop an application which has independent pluggable modules (DLL ?) with the core application passing some arrays of data to the plug-ins and getting back the processed data from the plug-in. The core application should run without error even if any corresponding module (plug-in/DLL) is missing at run-time. The core application should also be able to detect any new plug-in and load it dynamically. Any changes to the plug-ins should not require the core application to be re-built.
Grateful if anyone could advise the best possible solution to the above mentioned task - use explicitly linked DLLs or use COM ? Any sample codes or articles available for this?
I'll be using VC++ 6.0. Thanks a lot in advance !
|
|
|
|
|
You will probably get far more helpful, and a greater number of replies in the VC++ forums.
Though your search for an answer will almost certainly lead you back here at some point or another
Cata
|
|
|
|
|
Hi,
I'm just starting to use COM dlls but have come across what I believe must be a common problem for brainwashed MFC folk... absolutely any suggestions would be welcome!
I have a standard Windows app generated using Visual C++ V6.0 which uses a CRichEditCtrl control. The app is served by several COM dlls.
I would really like to dedicate one of the COM dlls to displaying the information in the CRichEditCtrl control. The problem is how do I tell the COM dll the pointer to the control?.
I have tried passing the control window handle (hwnd) and then using SendMessage(hwnd,,,). Thats OK for raw text but when I want to (say) get the defaultcharformat I really need the control's CRichEditCtrl* pointer.
I guess I could pass a void ptr and then cast to CRichEditCtrl* - but this seems to go against good COM practice? Can anybody recommend a COM friendly solution and restore my initial enthusiasm to program with COM!
Many Thanks
BarryM
|
|
|
|
|
Hi,
I eventually passed a long* ptr and casted back to CRichEditCtrl* in the COM method. Not nice but it seems to work. I hope to eventually discover the proper "COM" method of approaching this problem!
BM
|
|
|
|
|
I am trying to produce a library of objects relating to Drag and Drop. My library currently looks like this:
import "oaidl.idl";<br />
import "ocidl.idl";<br />
import "objidl.idl";<br />
[<br />
uuid(01020304-0506-0708-9010-011012013014)<br />
]<br />
library DragDrop{<br />
interface IDataObject;<br />
interface IEnumFORMATETC;<br />
interface IEnumSTATDATA;<br />
struct tagFORMATETC;<br />
struct tagDVTARGETDEVICE;<br />
struct tagSTGMEDIUM;<br />
struct tagSTATDATA;<br />
enum tagADVF;<br />
enum tagDATADIR;<br />
enum tagTYMED; <br />
};
However I have a problem. While I have found many of the interfaces and structures used by the IDataObject and it's proceeding object tree. I have been unable to find the STGMEDIUM object in any of my IDL import libraries. Do i need to include this in my library?
I have found a number of instances of STGMEDIUM object, but have not actualy found one that is the one I am looking for. there is remSTGMEDIUM, and uSTGMEDIUM. Which of these should I be using if any?
I would Have thought so if i want to compile it to a TLB.
Aditionaly, there are a number of structures and enumerations defined in the interfaces. Should I pull these out and implement them in the type library seperately? Or is this done automaticaly?
Is there anything else I am missing?
Thanks
Cata
|
|
|
|
|
hi Everbody
I know GUIDGEN.EXE with four select,but i don't know what meaning those are and how to use! I hope you tell me !
Thanks for your answer!
|
|
|
|
|
They are just different formats of typing the same thing.
MSDN Says:
The radio buttons in the GUID Format group box determine the format of the GUID the program will generate.
The first format is designed to be used in invocations of MFC's IMPLEMENT_OLECREATE macro.
The second format generates a reference to the DEFINE_GUID macro.
The remaining formats are appropriate for statically allocated GUID s and GUID s included in registry entries or registry editor scripts.
|
|
|
|
|
I'm trying to run midl, however, I am encountering error after error.
Cl.exe was not located in the correct location.
when i moved it, there was no mspdb70.dll to support CL.exe.
These components were all in different folders.
Is this right? Or is my instalation of .NET completely knackered?
Is it worth moving all the tools and associated DLL's into one directory? As it's really annoying.
I've copied all the stuff in the Vc7\bin folder to the common7\tools\bin folder.
I've moved the objidl.idl file into the tools\bin directory.
It's still not building objidl.idl. I get the error "Cannot open unkwn.idl"
help!
Cata
|
|
|
|
|
Either your install is seriously f'ed up or you didn't run vcvars32.bat before trying to exec midl.
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
Ahhh.... Gratz
didn't run vcvars32
What does it do?
I'm relatively new to the whole COM thing, and have only just discovered all these wonderful tools in VS.
Cata
|
|
|
|
|
I've run it through the command prompt (via windows), and it says that:
vcvars32.bat is not regognised as an internal or external comman, operable program or batch file.
do i have to run this in actual dos?
Cata
|
|
|
|
|
I had 3 versions of the batch file.
2 of them had the base bath, the third one was in quotes.
the third one worked.
Weird.
Cata
|
|
|
|
|
It does what I was telling you about in the C# forum - it sets the BIN, INCLUDE, and LIB env. vars. to directories associated with VS.NET (including its common directories, the PSDK (if installed with VS.NET), and the Framework SDK). It also sets up a few more helpful things.
Setting all these in your user or system env. vars. is even better, though, because then you don't have to worry about starting a command prompt with a certain batch script like the vcvars32.bat script. This way, any programming application that uses the env. vars. for such a thing and any command prompt you start (no matter how you start it) knows where to find executables (PATH), headers (INCLUDE), and libraries (LIB). The same goes for directories and JAR packages for Java (CLASSPATH).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
There's a Visual Studio 2003 Command Prompt entry in your VS.NET start menu folder.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Hi all..
I want to make a component (ATL) that returns an ADO Connection..
declaration of function :
STDMETHODIMP Cobj::get_Con(_ADOConnection *pVal)
{
.
.
.
return S_OK;
}
the problem is in the IDL :
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(DCF77B2B-1F18-4753-B0E5-6A937407509C),
dual,
helpstring("Iobj Interface"),
pointer_default(unique)
]
interface Iobj : IDispatch
{
[id(1), helpstring("method GetIt")] HRESULT GetIt();
[propget, id(2), helpstring("property Con")] HRESULT Con([out, retval] _ADOConnection *pVal);
};
[
uuid(310CB985-C3C4-4244-9D75-AB3345F8E982),
version(1.0),
helpstring("RetObj 1.0 Type Library")
]
library RETOBJLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("C:\Program Files\Common Files\system\ado\msado15.dll");
[
uuid(DAACB26F-1C20-455C-A1CE-2B979040A51F),
helpstring("obj Class")
]
coclass obj
{
[default] interface Iobj;
};
};
I get an erron neer the _ADOConnection :
error MIDL2025 : syntax error : expecting a type specification near "_ADOConnection"
any help please?
|
|
|
|