|
locoone wrote: my code is below the messagebox never goes off so i know its not working am i missing something?
When you close the message box the Paint message fires and it tries to repaint the invalid area..and again you shows the message in same....due to which it goes into infinite loop
like paint--message--paint---message----.......
Just remove the message and see the result...
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
i took out the message and it lloked bad i have a slider that is created after the dialog has been openit doesnt look good and i have a static that doesnt look goodthe background of both are still the tan looking color
|
|
|
|
|
Forget all ...see the following code
HBRUSH CtestMFCDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor== CTLCOLOR_DLG )
{
hbr=CreateSolidBrush(RGB(0,m_This.GetPos(),0));
}
return hbr;
}
void CtestMFCDlg::OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT *pResult)
{
InvalidateRect(NULL);
*pResult = 0;
}
The OnCtlColor methods returns the new brush created with the help of color selected.
m_This is the control variable of the Slider who ranges(0,255);
OnNMReleasedcaptureSlider1 is the method of slider control NM_RELEASEDCAPTURE notification.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
In PPC emulator, I create buttom in CChildview and press down the button to call a function. Also I use the left key in navigation control set to call the fuction. But if I press down the button then I can't call the funtion when I press down the left key??
void CChildView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar == VK_LEFT)
{
test();
}
CWnd::OnKeyUp(nChar, nRepCnt, nFlags);
}
BOOL CChildView::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if(wParam == ID_BUTTON)
{
test();
}
return CWnd::OnCommand(wParam, lParam);
}
Any Suggestion is helpful!!
Thanks a lot!!
Hello!!
|
|
|
|
|
;P;PHi,
I'm dev in China. I want to output some string of Chinese in unicode format(UTF-8/UTF-16). So in VS2003, I write code like this to test:
int _tmain(int argc, _TCHAR* argv[])
{
_TCHAR* buffer = L"汉";
unsigned char* uP = (unsigned char*)buffer;
return 0;
}
I found that the pointer 'uP' have this value:
uP : 186 (BA)
uP+1: 0
uP+2: 186 (BA)
uP+3: 0
The unicode of '汉' is: 6C 49
The Chinese code page (GBK) in windows of '汉' is : BA BA
So, the internal code in program only extand BA to BA 00
I test the code in VS2005 again, however, the internal code became 6C 49, is correct.
I don't know why.
Remy Zhu
|
|
|
|
|
You shouldn't use characters outside of the ASCII range in source code, because (as you saw) the parser may interpret the bytes differently according to the code page and character set that the app uses. Use the \x notation for the string literal: L"\x6c49"
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
OK, I have an internet filtering application that I have inherited. The current application does the internet filtering via a direct interface with Internet Explorer thus it does not work with FireFox or other non IE browsers.
So, I have been researching for days. I have not come to a clear solution on how the existing content filtering applications may have implimented there filtering.
Does anyone have experience writting an application that will filter internet content regardless of the internet browser. I would like to display a very simple Access denied type page in the browser. Just filtering based on the URL to start with would be good.
I am very open to using any language and comfortable with C++. Just seems that there are a large number of applications that already do this and I would be supprised to find that they are all using something like a TDI Hook DLL, Winsock LSP, etc... Just seems there should be an exposed API.
I really do not want the user to have to set proxy settings, I am still researching a silent/in-visible proxy server and looking into a Filter Monikor but, any suggestions on doing this would be much appreciated.
I am getting a little frustrated that I have not been able to find good information for doing this, Like I mentioned there are a ton of applications already doing this so it seems that I am missing something simple.
Thanks
Eric
Daymark Software, LLC
eric@daymarksoftware.com
|
|
|
|
|
Your not missing anything simple.
There are only 5 methods I can think of to filter internet content from the end-users machine that are acceptable.
1.) Transparent redirection
2.) Winsock proxy DLL (Not a good idea)
3.) Winsock LSP
4.) TDI layer filter
5.) NDIS layer filter
Internet Explorer hooks or Detours is simply not an option in my opinion. If your looking to filter network content with minimal coding, I would suggest that you take a look at the Layered Service provider samples that were included with the Platform SDK.
In the folder: \Microsoft Platform SDK\Samples\NetDS\WinSock\LSP
If you take a look at the ifslsp sample, you will see it demonstrate URL logging. If you want to implement a simple transparent redirect, you can modify this sample in about 5 minutes by simply editing the FindDestinationAddress() function. Simply redirect all outgoing HTTP request to 127.0.0.1 to a local filter.
However if your wanting to filter content without a localhost proxy you would need to extend the non-IFS sample. You have more control over winsock send and receives with the non-IFS.
If your looking for a more secure, method of content filtering, I'd recommend TDI layer. There is a sample here on codeproject than can be extended to accomplish this. I am telling you all of this from first-hand experience. I have already implemented an LSP based content filter, and then about a year ago I implemented a TDI based solution, and retired my old LSP based code.
Ultimately, the best method of content filtering is on the NDIS layer... But much of it is undocumented, and I have spent many hours experimenting with NDIS driver implementations. Maybe one of these days I will be able to make that work, but not yet Im not guru enough...yet
Best Wishes,
-randor
|
|
|
|
|
Hi,
I want to use LSP for inter filtering.
I want to modify buffer WSPRecv from non-ifslsp in order to insert forbidden error.
Please someone help me how can I modify this buffer and fill forbidden error message in this buffer.
So that, that forbidden response can be seen on browser.
|
|
|
|
|
Hi there,
I was wondering as to how one would use the WriteFile function. Say i have the following
HANDLE hOutput;
LPSTR = "Hello World";
LPCVOID pBuffer;
hOutput = CreateFile(TEXT("ouput.txt"), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL);
WriteFile(hOutput, pBuffer, sizeof(pBuffer),&dwWritten, NULL);
CloseHandle(hOutput);
How would I "place" the "Hello World" string into the pBuffer? The output file is being created however there is some gibberish in the text and not what I want. As well, WriteFile does fail and does return false.
Any help would be appreciated!
Thanks,
Robbie
-- modified at 21:04 Sunday 18th June, 2006
|
|
|
|
|
The buffer is a pointer to the block of bytes you want to write:
LPCSTR pData = "Hello World";
WriteFile(hOutput, (const void*) pData, strlen(pData), &dwWritten, NULL);
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
lol omg that is so embaressing. I was using bytes instead of strlen, so i was wondering why my stuff was getting cut off in the text file.
However thanks alot for solving the problem for me Mike, I appreciate it.
Robbie
|
|
|
|
|
The (const void*) cast is not needed; all pointers can be implicitly cast to a void* pointer and a non-const pointer can be implicitly cast to a const one. Casts which aren’t needed often turn out to be maintenance problems or even bugs as a project evolves.
Steve
|
|
|
|
|
i need help on how to make text scroll like in winamp does with the song title i seen a few classes that scrolled up i need right to left and maybe left to right.
|
|
|
|
|
Assuming you are having your text on a label, you can associate a control variable to that label and then use SetWindowPos() to set the window position in a for loop.(Keep changing the position of that window in any loop)
Alternatively See TextOut()/DrawText().
I hope that I made myself clear...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 23:50 Sunday 18th June, 2006
|
|
|
|
|
sorta clear im a noob and dont know what a label is yet
|
|
|
|
|
A label is a static control.You will have to change IDC_STATIC to associate control variable to it. After this follow the procedure mentioned in my previous post.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hallo
I have some project written and this is working fine. Now i have a base class not a abstract class and some derived.
Now i want to handle each derived class in a separate dll.
Now is this possible ?? And if so how to manage this ?? Do i have to make a lot of changes??
Thanks
Timen
|
|
|
|
|
You may have to add the base class in each DLL and derive the class from that base class..
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I'm trying to use WriteConsoleOutput to print blocks of text to the screen (strings/streams). I would use WriteConsole() but then I have to move the cursor position after each line is printed and that isn't very elegant. I'm getting this error:
c:\Documents and Settings\John\My Documents\Visual Studio Projects\Testing_Win32_Console\Testing_Win32_Console.cpp(40): error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::allocator<_Ty>::value_type' (or there is no acceptable conversion)
with
[
_Ty=char
]
I know this is probably a really stupid question but I couldn't find any good examples of WriteConsoleOutput() in use on the internet, and I don't have anyone else's brain to pick.
The relevant line has a smiley next to it:
<br />
#include iostream
#include string<br />
#include windows.h<br />
<br />
using namespace std;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
HANDLE hIn;<br />
HANDLE hOut;<br />
string TextToPrint;<br />
CHAR_INFO TemporaryBuffer[20];<br />
CONSOLE_SCREEN_BUFFER_INFO BufferInformation;<br />
COORD TextToWriteSize;<br />
COORD UpperLeftText;<br />
PSMALL_RECT DestCoords;<br />
<br />
hOut = GetStdHandle(STD_OUTPUT_HANDLE);<br />
hIn = GetStdHandle(STD_INPUT_HANDLE);<br />
GetConsoleScreenBufferInfo(hOut, &BufferInformation);<br />
TextToPrint = "It worked!";<br />
TextToWriteSize.X = TextToPrint.length();<br />
TextToWriteSize.Y = 1;<br />
UpperLeftText.X = 0;<br />
UpperLeftText.Y = 0;<br />
DestCoords->Top = 5;<br />
DestCoords->Left = 5;<br />
DestCoords->Right = 5 + TextToPrint.length();<br />
DestCoords->Bottom = 6;<br />
<br />
for(int i; i < 20; i++)<br />
TemporaryBuffer[i].Attributes = BufferInformation.wAttributes;<br />
<br />
for(int i; i < TextToPrint.length() - 1; i++)<br />
TemporaryBuffer[i].Char = TextToPrint[i]; :mad:<br />
<br />
WriteConsoleOutput(hOut, TemporaryBuffer, TextToWriteSize, UpperLeftText, DestCoords);<br />
<br />
cin.get();<br />
<br />
return 0;<br />
}<br />
-- modified at 16:13 Sunday 18th June, 2006
|
|
|
|
|
Hi,
There is alot wrong with your source code.
1.) PSMALL_RECT is a pointer, and you never assign it.
2.) In your for-loops, you need to assign the integer i a value. Modern ISO compliant compilers will not default to zero without bitterly complaining.
3.) In your second for-loop, you use a condition of (TextToPrint.length() - 1) which is incorrect. This will cause the last character to be omitted.
4.) Your assigning TemporaryBuffer[i].Char an incorrect string value.
Here is a repaired version that should work:
<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
HANDLE hIn;<br />
HANDLE hOut;<br />
string TextToPrint;<br />
CHAR_INFO TemporaryBuffer[20];<br />
CONSOLE_SCREEN_BUFFER_INFO BufferInformation;<br />
COORD TextToWriteSize;<br />
COORD UpperLeftText;<br />
SMALL_RECT DestCoords;<br />
<br />
hOut = GetStdHandle(STD_OUTPUT_HANDLE);<br />
hIn = GetStdHandle(STD_INPUT_HANDLE);<br />
GetConsoleScreenBufferInfo(hOut, &BufferInformation);<br />
TextToPrint = "It worked!";<br />
TextToWriteSize.X = TextToPrint.length();<br />
TextToWriteSize.Y = 1;<br />
UpperLeftText.X = 0;<br />
UpperLeftText.Y = 0;<br />
DestCoords.Top = 5;<br />
DestCoords.Left = 5;<br />
DestCoords.Right = 5 + TextToPrint.length();<br />
DestCoords.Bottom = 6;<br />
<br />
for(int i=0; i < 20; i++)<br />
TemporaryBuffer[i].Attributes = BufferInformation.wAttributes;<br />
<br />
for(int i=0; i < TextToPrint.length(); i++)<br />
{<br />
TemporaryBuffer[i].Char.AsciiChar = (char)TextToPrint[i];<br />
TemporaryBuffer[i].Char.UnicodeChar = (WCHAR)TextToPrint[i];<br />
}<br />
<br />
WriteConsoleOutput(hOut, TemporaryBuffer, TextToWriteSize, UpperLeftText, &DestCoords);<br />
<br />
cin.get();<br />
<br />
return 0;<br />
}<br />
<br />
Note: Your compiler will have Unicode or Ascii build environments. This version should work in both.
|
|
|
|
|
hello
I want to create a 2D 170*140 arrey with new .
I wrote :
float **safhe;
*safhe=new float[170];
for(int i=0;i<170;i++)
safhe[i]=new float[140];
but I dont know what is wrong
thank you
|
|
|
|
|
V_shr wrote: *safhe=new float[170];
You're dereferencing a pointer that you haven't assigned anything to yet. This is never what you want.
float **safhe;
<span style="color: Blue;">safhe=new float[170];</span><br style="color: Blue;">for(int i=0;i<170;i++)
safhe[i]=new float[140];
See the difference? Both *safhe and safhe[i] dereference a pointer, with safhe[i] effectively adding i * sizeof(float) to the address before dereferencing.
|
|
|
|
|
hello
thank you for your help
BUT
when I change that to "safhe=new float[170]" this error apears :
cannot convert 'float *' to 'float * *'
???
|
|
|
|
|
Sorry, missed that bit. You don't want to allocate an array of 170 float s, you want 170 float* . So, do something like:
safhe = new float*[170];<br />
<br />
|
|
|
|