|
Yes I get it....
I have found it... the elusive registry key that makes Windows crash..
http://support.microsoft.com/?kbid=244139[^]
This is so funny I can't wait to try it out.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
I wrote a function to write an integer to a file (i also wrote a function to write a string to a file, which works almost exactly the same way) but windows gives me an access violation error on it or something (the string function works fine btw, so its not the file mode etc.).
Here's the code:
int WriteInt(int Int, long pos)
{
if(fseek(npf, pos, SEEK_SET))
{
return -1;
}
int numwritten = fwrite((void*)Int, sizeof(int), 1, npf);
if(numwritten!=1)
{
return -1;
}
return 1;
}
npf is a valid open file stream to which i CAN write strings etc.
Any ideas why this wont work?
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
int numwritten = fwrite((void*)Int, sizeof(int), 1, npf);
You are converting an integer to a memory address - so it will try to read from the address of the value currently in Int. Try:
int numwritten = fwrite(&Int), sizeof(int), 1, npf);
Dave
|
|
|
|
|
thanks, it solved my problem
Kuniva
--------------------------------------------
|
|
|
|
|
I am looking for a sample where you can paste in HTML format.
I got Rich Edit control and strData contains like this
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17
\par \b Test\b0
\par
What I am expecting is like this:
< HTML > (intended spaces there)
< B >Test < / B> (intended spaces there)
< / HTML> (intended spaces there)
Code from Copy to Clipboard function:
UINT format = ::RegisterClipboardFormat("HTML Format");<br />
<br />
if (strData.IsEmpty())<br />
return;<br />
<br />
CSharedFile sf(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT);<br />
sf.Write(strData, strData.GetLength() * sizeof(TCHAR));<br />
<br />
if (!OpenClipboard())<br />
return;<br />
<br />
EmptyClipboard();<br />
<br />
SetClipboardData(format, sf.Detach());<br />
<br />
CloseClipboard();
But when I paste into another control(Edit), all I get is RTF only.
Do I need to convert from RTF format to HTML format??
If yes, then what's the use of CF_HTML("HTML Format") parameter??
Kant
|
|
|
|
|
DevStudio includes utility DataObjectViewer to allow you play with Clipboard.... (Enum Formats etc ).
I belive RichEdit does not support CF_HTML.
|
|
|
|
|
In my application there is a choice of two languages, Norwegian or English. They use different locales with comma or periode as decimal symbol, respectively. I'd like the decimal symbol on the numeric keypad to return the symbol which corresponds to the locale, whereas the comma/periode on the main keypad should remain unchanged. Excel has this functionality
I guess I should put an if() statement in OnChar(). I've noticed that the nFlags parameter in OnChar()is different if the decimal symbol is pressed from the numeric keypad or the main keypad, but I can't figure out how to interpret it. MSDN also has a statement that applications can not extract usefull information from nFlags. So, any tips..?
Regards, Haakon S.
|
|
|
|
|
I'm not sure, but the following might work.
in ::PreTranslateMessage()
if((pMsg->Message == WM_CHAR && pMsg->wParam == xx) && m_bNorwegian)
{
AfxGetMainWnd()->PostMessage(WM_CHAR, VK_COMMA);
return true;
}
where:
xx is the number corresponding to numeric period key. You can get this with a quick debug session.
m_bNorwegian is your flag to know which language your in.
I'm new to this stuff, but it seems like it would work.
BW
"We get general information and specific information, but none of the specific information talks about time, place or methods or means..."
- Tom Ridge - US Secretary of Homeland Security
|
|
|
|
|
Well, on my keypad the decimal symbol (numeric period) is comma, not period. But it is an interesting approach, I'll try it. Thank you for your help.
Regards, Haakon S.
Runners live two years longer. But those two years they spend running.
|
|
|
|
|
Haakon S. wrote:
I can't figure out how to interpret it
Every key on the keyboard has a unique scan code. You can retrieve that code from the bits 0 to 15 of the nFlags parameter. IIRC the scan codes for the main keypad are standard, but all other keys are OEM specific, they are not guaranteed to be the same across all systems.
UINT scancode = nFlags & 0xFF;
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
You can retrieve that code from the bits 0 to 15 of the nFlags parameter
But MSDN reads, under OnChar():
"Value 0-15
Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key."
If you look up under OnKeyDown(), you'll see a description more in line with yours, but it also says that the scan codes are OEM specific. However, I'll try to dig into this. If Excel can do it, so can I.
Thanks alot, anyway.
Haakon S.
Runners live two years longer. But those two years they spend running.
|
|
|
|
|
Not sure if this belongs here or in the COM discussion. Since I created an mfc ActiveX control with the mfc ActiveX Wizard, I'll try here...
I created my first ActiveX control, and successfully installed it on my machine with
regsvr32 "my controls name"
Then I fired up VB and verified that I could use the control in a VB application. I was fat dumb and happy. To test it, I sent the .ocx file to a friend and had him put it in C:\temp. (The controls name is transponder.ocx)
I had him execute the following from "Start" "Run"...
regsvr32 C:\temp\transponder.ocx
When he executed the command, he got the following error...
Load Library
“C:\temp\transponder.ocx” failed – the specified module could not be found.
Any idea what this is trying to tell me? I set up the project as a static build, so I don't think it's looking for any dlls.
|
|
|
|
|
Use dependancy walker to see what DLLs it does need. Even if it is statically linked to MFC, it may still require the C-runtime DLLs (e.g. msvcrt.dll).
Dave
|
|
|
|
|
WOW...
According to dependency walker, it requires the following...
kernel32.dll, user32.dll, gdi32.dll, comdlg32.dll, winspool.drv, advapi32.dll, shell32.dll, comctl32.dll, ole32.dll, olepro32.dll, oleaut32.dll at the first level
Then each of them has a list!
Is it necessary to include all these in an install utility?
Does one of these look like a good candidate for something that's not typically loaded in a Win2000 installation?
Thanks!
|
|
|
|
|
Hello,
I was wondering if it was possible to pass variables from Macromedia Director into a C++ programme? It can be done rather easily using Flash (from the look of things) but I need to be able to do it in Director. I have searched the web and very little is mentioned. Any help would be greatly appreciated.
Regards,
Moo
|
|
|
|
|
Any one have any ideas about it?
|
|
|
|
|
Hello,
I'm debugging my last program... and today I've acquired Rational Purify (trial version) in order to receive help on this task...
after running my program under Rational Purify, I've found some memory leaks... but now I'm not sure of which is my name (almost)...
let's see, it says that this code is leaking memory:
-------------------------------------------------------------
-------------------------------------------------------------
// Variables que permeten la construcció del codi HTML.
CString csCodiHTML = "HTML STRING...";
BSTR bstr;
int iWidthAreaClientHTMLCtrl = 0;
// Tractament del SafeArray.
HRESULT hrTractarAmbSafeArray = S_OK;
SAFEARRAY *pSafeArray = NULL;
VARIANT *pElement = NULL;
extern CTCCApp TCCApp;
//------------------------------------------------
// Obtenir accés al control HTML via ATL.
//------------------------------------------------
CComQIPtr<IHTMLDocument2> spHTMLDocument = this->m_HTMLCtrl.GetHtmlDocument();
if(spHTMLDocument)
{
CComQIPtr<IHTMLElement> spHTML;
spHTMLDocument->get_body(&spHTML);
if (spHTML)
{
bstr = csCodiHTML.AllocSysString();
spHTML->put_innerHTML(bstr);
spHTML.Release();
SysFreeString(bstr);
csCodiHTML.ReleaseBuffer();
csCodiHTML.FreeExtra();
}
else
{
pSafeArray = ::SafeArrayCreateVector(VT_VARIANT, 0, 1);
if (pSafeArray)
{
hrTractarAmbSafeArray = ::SafeArrayAccessData(pSafeArray,(LPVOID*) &pElement);
pElement->vt = VT_BSTR; // HERE!
pElement->bstrVal = csCodiHTML.AllocSysString();
hrTractarAmbSafeArray = ::SafeArrayUnaccessData(pSafeArray);
hrTractarAmbSafeArray = spHTMLDocument->write(pSafeArray);
::SafeArrayDestroy(pSafeArray);
csCodiHTML.ReleaseBuffer(); // HERE TOO!
csCodiHTML.FreeExtra();
}
}
}
if (spHTMLDocument) spHTMLDocument.Release();
-------------------------------------------------------------
-------------------------------------------------------------
Where you can see HERE! and HERE TOO! is where that program Rational purify is detecting some memory leaks... do you think that the code is leaking memory?
and if so... why? I thought that if I have not called new I should'nt call delete and that whenever the function goes out of scope the local variables are destructed automatically... isn't it true?
Thank you in advance...
|
|
|
|
|
You are missing a call to SafeArrayUnaccessData.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
"Resource acquisition is initialization"
I love it.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
|
Actually, it is in the code. I must have missed it first time around.
*shrug*
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I don't think there are leaks in your code.
It could be that the complaint is about the line below //HERE, as your tool has no way of knowing that SafeArrayDestroy() will delete the BSTRs in the array.
Also, in my opinion, your calls to ReleaseBuffer() and FreeExtra() are not necessary.
Cheers,
Rob.
|
|
|
|
|
hi, I need some advice about using and connecting the CBaseControlWindow into the IGraphBuilder interface.thnx
J.
|
|
|
|
|
Does anybody know of a good way to convert a bitmap to jpeg.
At the moment i'am wrinting a small application that creates BITMAPS but i actually need to convert them to jpeg?
What is the best or esiest way to do so?
|
|
|
|
|