|
|
i oso know! but cannot leh~
|
|
|
|
|
I don't understand - you're saying you know to use CFile but don't know how ? Here is the MSDN online, you can look up the syntax and examples there.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi,all
I want to get local network info.
My system is win2000 and my connection to Network is well.But when I use WNetGetNetworkInformation(lpProvider,lpNetInfoStruct) to get Network info,lpNetInfoStruct.dwStatus is setted to WN_NO_NETWORK.
but if the environment is WIN98,it works well and can get correct network info.
why?
how can I solve it?
Thanks!
|
|
|
|
|
I have a component thingy for Borland C++ Builder or something like that. My question is: is there a way to convert this to ActiveX, or VC++ compatible class? I have the source for it but not C++ Builder.
-Matt Newman
|
|
|
|
|
Unfortunately not if you haven't got C++ builder
|
|
|
|
|
Hello;
In following code:
int twod_array[3][4] = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12} };
int (*ptr2array)[4];
ptr2array = twod_array;
(1) int (*ptr2array)[3][4] generating error why?
(2) I'm getting 4 row and all addresses are same in ptr2array. So why?
When should i use pointer to array?
|
|
|
|
|
You're generating an array of pointers. You need to go
int * pArray = new int[3][4];
to get a pointer to an array.
Christian
As I learn the innermost secrets of those around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
But, when shold i use pointer to array?
|
|
|
|
|
Why should you ? I don't get the question. What I showed you is how to create a pointer to an array of the same size. Do you want instead to create an array of pointers, as you were ? If so, why ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Is there an easy way in MFC to parse a string like UNIX awk?
|
|
|
|
|
What does awk do ? What are you after ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I have done some UNIX shell programming and there is a language called awk that is really useful for parsing non uniform strings separated by a delimiter.
I am trying to parse strings like the following lines of data
COMP R7002 06R55199D30 RES sm_r0402 4.58 2.996 2 180
COMP R7003 06R55161B15 RES sm_r0402 4.708 2.65 2 0
COMP C3023 21R55169G21 CAP sm_c0402 0.791 3.659 2 180
COMP C3024 21R55169G21 CAP sm_c0402 0.706 3.588 2 0
COMP U3000 51R44976U01 LM3477MM sm_soic8_gt099_026_xa 0.563 3.64 2 0
as you can see they are not completely uniform.
I can write a loop looking at each char and then chop up the string into variables, I was just wondering if there was an faster (and easier) way
CString str;
CString tmpstr;
for(int i=0; i < m_objRawData.GetUpperBound(); i++)
{
str = m_objRawData.GetAt(i);
if(str.Left(4) == "COMP")
{
while(str.GetLength() > 0)
{
tmpstr = str.SpanExcluding(" ");
str.TrimLeft(tmpstr + " ");
}
}
}
|
|
|
|
|
Thanks for clarifying. I think strtok may be what you want.
Example
/* STRTOK.C: In this program, a loop uses strtok
* to print all the tokens (separated by commas
* or blanks) in the string named "string".
*/
#include <string.h>
#include <stdio.h>
char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;
void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
Output
A string of ,,tokens
and some more tokens
Tokens:
A
string
of
tokens
and
some
more
tokens
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I have never had this problem with VC, but anyhow today I was trying to debug a code and I place a breakpoint within a function in the view file and when I try to debug it, it prompts with the release message that the breakpoint is not valid. Any idea why this would happen in debug mode?
|
|
|
|
|
Try clean and rebuild all in debug mode. Check if you have put the break points in the proper files. There is a chance that you have put the break point in a copy of your actual file.
|
|
|
|
|
[ Returning to MFC-land after a year long journey into Java. Please forgive my feeble brain... ]
I have a dialog (CMyDialog) that doesn't have a title bar. I override OnNcHitTest() to return HTCAPTION, which allows me to move the dialog by dragging its client area.
CMyDialog contains a modeless child dialog (CMyChildDialog) within it. The child dialog happens to contain a couple of static text controls that are asynchronously updated based on some events in the universe.
Q: How do I allow CMyDialog to be dragged when I initiate the drag from within CMyChildDialog? (I don't want to override CMyChildDialog::OnNcHitTest() because I don't want the child dialog to be movable within its parent.)
Thanks,
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Sorry, I should've RTFM. Many thanks!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
A cleaner way is to override WM_LBUTTONDOWN:
void CSomeDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
PostMessage ( WM_NCLBUTTONDOWN, HTCAPTION, MAKEPOINTS(point.y << 16 | point.x) );
} That way you don't have to handle any special messages in the child dialogs.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
MAKEPOINTS gives a compiler error. It works without this macro.
void CSomeDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
PostMessage ( WM_NCLBUTTONDOWN, HTCAPTION, (point.y << 16 | point.x) );
}
|
|
|
|
|
I'm already overriding the LButtonDblClick handler, so I'd prefer not to override OnLButtonDown as it can cause conflicts.
Trivia: I'm also overriding OnNcRButtonUp to display a context menu, since OnContextMenu() no longer works since the OS thinks I'm always on the caption bar. I considered just adding a caption bar and menus, but that would ruin the flavor of the app (it looks like a toolbar).
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I am currently trying to save a CBitmap to disc. And Have the following questions.
Is A CBitmap Always A DIB?
Is A HBITMAP Always A DIB?
Does anyone know any good resources for saving CBitmaps to disc?
I have been looking at the routines, on codeguru.com wrote the following code using them. All i get though is a blank bitmap.
HBITMAP testbmp;
testbmp= (HBITMAP) LoadImage(0,"C:\\orginal.bmp",IMAGE_BITMAP, NULL, NULL, LR_LOADFROMFILE);
CBitmap test;
test.Attach(testbmp);
WriteDIB( "C:\\two.bmp", DDBToDIB(test,BI_RGB,NULL));
The second parameter of DDBToDib is the compression, and the third is the palette, if no palette, is provided the default is used.
Anyone any clues where i am going wrong, all i get is a blank bitmap. I am using a 24bit BMP but tried tried with others.
Thanks Again
Richard
|
|
|
|
|
Is A CBitmap Always A DIB?
No.
Is A HBITMAP Always A DIB?
No.
Check the DIBLOOK sample in your VC++ help for bitmap-saving code.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Is A CBitmap Always A DIB?
Is A HBITMAP Always A DIB?
It's usually a DDB.
Does anyone know any good resources for saving CBitmaps to disc?
Plenty on the site. Look around.
I have been looking at the routines, on codeguru.com wrote the following code using them. All i get though is a blank bitmap.
HBITMAP testbmp;
testbmp= (HBITMAP) LoadImage(0,"C:\\orginal.bmp",IMAGE_BITMAP, NULL, NULL, LR_LOADFROMFILE);
This is not a DIB - you didn't specify LR_CREATEDIBSECTION.
CBitmap test;
test.Attach(testbmp);
WriteDIB( "C:\\two.bmp", DDBToDIB(test,BI_RGB,NULL));
The second parameter of DDBToDib is the compression, and the third is the palette, if no palette, is provided the default is used.
Anyone any clues where i am going wrong, all i get is a blank bitmap. I am using a 24bit BMP but tried tried with others.
I'd suggest that the problem is the flag I've pointed out. You also need when creating bitmaps to create a DIBSection. A DIBSection is a DIB that can be selected into a DC and attached to a CBitmap. There are good DIBSection wrappers here and on paintlib.de
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|