|
Hi,
I've developed a COM object that uses DDE library functions. When I used that COM object in any VB application DDE calls are working fine. But, when I used that COM object in a web application, which is developed with ASP & IIS server, DDE calls are failing. Any suggestions please?
thanks
ramulu
|
|
|
|
|
Hi All,
What are the Pro's and Con's of using ActiveX control over OLE automation
in MFC application? I appreciate your help.
|
|
|
|
|
my view is derived from CView;
there are two rulers on the top and left.like ms word.
i want scroll the graphic view but rulers by call the funtion
ScrollWindow() to scroll window party.
the question is how can i deal with the area out of view?
fjn
|
|
|
|
|
I would like to have registration keys for my program that I am about to release. The thing is that from the suggestions that I have read online, I kind of get the feeling that I should not use GetWindowsText() or GetDlgItemText() because crackers set breakpoints on those functions. I should use low level routines. But I have no clue on how to do that. Could I get any suggestions? Any tutorials?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Add a CString variable that corresponds to the editbox of the registration key.
Kuphryn
|
|
|
|
|
That can still be captured by setting a breakpoint to GetWindowsText.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I do not think securing the process getting text from an editbox is going to matter in terms of program security. A secure project will require encryption based on, say, the NIC.
Kuphryn
|
|
|
|
|
kuphryn wrote:
do not think securing the process getting text from an editbox is going to matter in terms of program security
I am not sure about that. Setting a breakpoint on GetWindowsText will stop the program at the point where the entered key is being read. From there, the program can be single steped until this key is compared the real key. It is irrelevant whether the key has been encrypted or not because a simple jmp instruction can bypass the testing. The whole idea is to prevent someone from tracing the program after a registration key has been entered. I mean if they don't have a starting point they can't trace. Writing low level routines to read text is not something I came up with. I've read about it on several websites but nobody explains how to do it.
kuphryn wrote:
A secure project will require encryption based on, say, the NIC.
What do you mean by that? Could you suggest any websites where I can read more about that subject?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
You could avoid this approach by doing your registration check at the start of the application. Once the user enters the key, save it (registry/disk), force them to restart the app.
Then again, anybody with any lick of knowledge in SoftIce could easily break when a reference to that regkey or disk file is made.
Nothing is crackproof unfortunately, though there are a few really good third-party methods out there.
Mike.
|
|
|
|
|
Thank you everyone
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
iv looked here but all the examples are terribly complicated and require starnge stuff and what not. What i am looking for is a way to play a wave file with as little trouble as possible. any recommendations for tutorials or whatever would be very helpful. thanks
Have a nice day
|
|
|
|
|
try the sndPlaySound() API[^].
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
What is the fastest way to write formated text to a file. I am currently using "fprintf".
Just wondered if there is a faster way.
|
|
|
|
|
Depends on how you define "fast".
If you meant small code: use fopen fprintf and fclose.
If you meant fast writing: use Win32 file API or/and mapped files.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hello all,
When I use StreamOut feature of RichEditCtrl, I have a problem with large content. My StreamOut function always gets 2050 characters although my RichTextCtrl contains up to 300000 characters.
Please take a look on my code below and tell me why.
DWORD __stdcall MyStreamOutCallback(DWORD dwCookie,LPBYTE pbBuff,LONG cb,LONG *pcb)<br />
{<br />
USES_CONVERSION;<br />
LPWSTR lpUniText = T2W((LPTSTR)pbBuff);<br />
CString * psBuffer = (CString *)dwCookie;<br />
*psBuffer = CString(lpUniText);<br />
*pcb = wcslen(lpUniText);<br />
return 0;<br />
}<br />
<br />
CString GetSelText(CRichEditCtrl &rtf)<br />
{<br />
CString strOut;<br />
EDITSTREAM es;<br />
es.dwCookie = (DWORD)&strOut;<br />
es.pfnCallback = MyStreamOutCallback;<br />
rtf.StreamOut(SF_TEXT|SF_UNICODE,es);<br />
CHARRANGE cr;<br />
rtf.GetSel(cr);<br />
<br />
strOut = strOut.Mid(cr.cpMin,cr.cpMax-cr.cpMin-1);<br />
TRACE(_T("\ncpMax-cpMin-1 = %ld"),cr.cpMax-cr.cpMin-1);<br />
<br />
return strOut;<br />
}<br />
<br />
void CTestRTFView::OnButton1Click()<br />
{<br />
CRichEditCtrl &rtf = (CRichEditCtrl &)GetRichEditCtrl();<br />
CHARRANGE cr;<br />
rtf.SetSel(0,-1);<br />
CString str = GetSelText(rtf);<br />
}
Is my StreamOut function correct? Please give me a way to use StreamOut with a large content.
Thank you very much for your help.
|
|
|
|
|
Here's the methods that I use, which happily work for thousands of characters!
CString CRichEditViewEx::GetContent()
{
CString strContent = "";
EDITSTREAM es;
CMemFile memFile;
es.dwCookie = (DWORD) &memFile;
es.pfnCallback = StreamOutCallback;
GetRichEditCtrl().StreamOut(SF_RTF, es);
memFile.SeekToBegin();
char szBuff[GETCONTENT_BUFFER + 1];
memset(szBuff, 0, GETCONTENT_BUFFER + 1);
while(memFile.Read(szBuff, GETCONTENT_BUFFER) > 0)
{
strContent += CString(szBuff);
memset(szBuff, 0, GETCONTENT_BUFFER + 1);
}
return strContent;
}
DWORD CRichEditViewEx::StreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CMemFile *memFile=(CMemFile *)dwCookie;
memFile->WriteHuge(pbBuff,cb);
*pcb = cb;
return 0;
}
Note that here I am getting the RTF - to just get the text, you need to change the flag SF_RTF to SF_TEXT , like you have in your code - and of course add SF_UNICODE if required.
If you want to get just the selected text, which is what the line strOut=strOut.Mid(....) seems to imply, then instead of doing CString::Mid() , you can use the flag SFF_SELECTION along with SF_TEXT et al.
|
|
|
|
|
Hello,
I have followed your code, but I have a Debug Assertion Failed at line 102 of file filemem.cpp when it executes to line:
while(memFile.Read(szBuff, GETCONTENT_BUFFER) > 0)
Can you tell me what happens.
Thank you very much for your help.
|
|
|
|
|
I'm confused. Delving into the CMemFile code, it looks like the internal CMemFile buffer is NULL, which means that (memory shortage problems aside) the rich edit control has never called the callback to write to the file.
It might be worth putting a breakpoint before the offending line and taking a look at the memFile member variables to see if there is indeed a valid looking buffer in there!
If there is no buffer, it could be down to where you are calling the function from - could it be at a point where the rich edit control might have already cleared down the content and started destroying itself?
Just out of interest, what did you set GETCONTENT_BUFFER to? I set it to 4096.
Sorry I can't be any more help!
|
|
|
|
|
You use the compiler switch /Zc:forScope if you want standard C++ behavior for for loops with Microsoft extensions (/Ze). Standard behavior is to let a for-loop's initializer go out of scope after the for loop.
However, this switch APPEARS not to work if you are watching the value of a for-loop's initializer in a Watch Window
Consider the following code compiled with /Ze and /Zc:forScope:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<code>#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
float doug[3] = {0.0};
for (short i = 1; i < 3; i++)
{
doug[i] = 3.3;
} //next i
short i = 0;
short a = i;
cout << i << endl << a ;
return 0;
}</code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Firstly, you get a compiler warning:
warning C4258: 'i' : definition from the for loop is ignored; the definition from the enclosing scope is used.
The warning is at the line:
<code> short i = 0;</code>
I claim that this warning is nonsense, since the definition of "i" should not exist at this point. How can you ignore something that does not exist?
Anyway, run the code past the for-loop and pause at the line:
<code> short i = 0;</code>
Note at this point that, according to the Watch Window
i = 3
a = -13108 (Why should "a" even exist at this point, albeit with a nonsense value?)
Now pause at the line:
<code> cout << i << endl << a;</code>
Note that the Watch Window says
i = 3
a = 0
In other words the Watch Window reports the value of "i" INCORRECTLY, whilst internally the program seems to have got the right idea.
Pinch yourself and see if you are not hallucinating with the line:
<code> cout << i << endl << a ;</code>
Yup ... both "i" and "a" really do seem to have value = 0, BUT the Watch Window STILL says that i = 3!
(Incidently disabling Microsoft extensions altogether with /Za fixes the Watch Window problem)
This is all very unsettling for a beginner programmer.
2 Questions:
1. Can anyone shed any light or comment? Am I missing something?
2. According to the Watch Window, why does "a" seem to exist before getting to the line:
<code> short a = i;</code> ???
Thanks to all,
Doug
Doug
|
|
|
|
|
Use gcc.
BuggyMax
|
|
|
|
|
I cannot use gcc in my code.
Benchmarking shows that gcc in my application, which is computation intensive, slows it down to 1/3 of the unmanaged version.
Doug
Doug
|
|
|
|
|
//This code works but the string is signed. How do I convert a large DWORD to a string format?
thanks
DWORD dw = 4294967281; //0xFFFFFFF1;
CString strNum;
strNum.Format("%d", dw);
DWORD dw2 = atol(strNum); //problem strNum looks like -15 and not 4294967281
ASSERT(dw == dw2);
|
|
|
|
|
|
%u - thank you very much!
|
|
|
|
|
I'm adding a new feature into my program that will move saved games (for Microsoft's Freelancer) to different folders. The problem is, saved games reside in each users' "My Documents\My Games\Freelancer\Accts\SingePlayer" folder, and I don't know how to find other users' My Documents folders. Is that possible? It's fine if the solution requires admin priviledges in 2000/XP.
|
|
|
|