Covinus 21 Junior Poster

im not sure if i can convert it. never seen a VB.net code yet. and when i installed my Visual studio.net i did not include VB.net..

Im trying to analyze the C# code i have but im getting confused.

sigh..

Covinus 21 Junior Poster

:'(

Covinus 21 Junior Poster

how's that if u r a smoker u can be a second hand smoker ???? :S

smokers get 1st and second hand smoking.

Covinus 21 Junior Poster

@ jbennet

i have a program in c# its from Microsoft it was a featured code from there magazine. I just want to do it in C.
Never tried c# before.

Covinus 21 Junior Poster

i churi..

Windows 2000, Visual C++ 6

Covinus 21 Junior Poster

Im a smoker myself. wakeke


In my point of view smokers have to consider the non-smokers. Indeed second hand smoke is harmful. I usually throw my newly lighted cigarretes when is see kids in the area.

I hate second hand smoke as well its irritating my nose.

Covinus 21 Junior Poster

I want to make a program that monitors your cpu, virtual and physical memory. Can anyone give me a head start. Is there a standard function to know cpu usage, how much memory left, etc

Whats the right term to search for monitoring computer resources in c? I tried some google search but to no avail.

Thanks in advance

Covinus 21 Junior Poster

sorry dude. anyway the link was kinda helpful thanks.

threads are still my last option. anyway tomorrow if i dont find one il have to learn threading

Covinus 21 Junior Poster

its a console based and windows operating system

Covinus 21 Junior Poster

the link leads you to an error page.

if i have no choice at all i will use multi threading. or just dump this feature in my program.

Covinus 21 Junior Poster

whats the function that waits for a keyboard input?

in assembly i know that there is a code to doesnt need to press enter to input. it you can loop it so it can act like a timer. but whats the equivalent code for c++?

Covinus 21 Junior Poster

im making a timer program. that when a user dont input something in a specific time. the program will go to another menu

so far in my research. threads would be the solution to this. but in my current status right now as a c++ programmer. i dont think im capable of handling threads yet.

any suggestion to how to solve this problem would be greatly appreciated..

ps

dont want to use third party. im not allowed to use them

Covinus 21 Junior Poster

windows versus linux?

both have strenghts and weaknesses against each other. its just a matter of a persons preferences. choose what fits your need...

ive been using windows for more than 9 years already. i would rate satisfactory on their os.
what i hate most about windows is that your paying a lot and the os is not worth the money. bugs there bugs here. (i have not tried vista yet)

linux on the other hand is free. hehehe.

Covinus 21 Junior Poster

I am a beginner that is learning C++. I would like to now how everyone else learnt C++.

ive learned it the hardway. from scratch i have to do intermediate programming modules in a day or two. (the basics are just inserted during research time) <- this is not a good idea

since its requird for work i cant do anything about it.

my advice is get a solid foundation of this language. (it language can get unsafe if you miss use it)

Covinus 21 Junior Poster

i have solve this problem. hehehe. i reinstalled my postgres. and i found out that their where some uncheck boxes during my install.

thanks for the help guys!

~s.o.s~ commented: Thanks for the follow up, would help some other beginner. +21
Covinus 21 Junior Poster

yep. i really dont have much background in c and databases. its only been a month since i started learning c/c++ and first time in using database. :'(

Covinus 21 Junior Poster

one more question .

sqlapi is a wrapper of libpq of postgres how can i use sqlapi if libpq also does not exist in my machine.

Covinus 21 Junior Poster

as much as posible i shouldnt use third party. but if i cant use the standard il have to use third party as last resource.

thanks for the reply

Covinus 21 Junior Poster

ive been trying to connect my c program and a postgre database using VC++. but i cant compile it because it cant find "postgres_fe.h". and also i cant find any tutorials about this one too. When i searched google, most are for linux. if anyone here knows some links to a site pls post here. any help will be greatly appreciated.

Covinus 21 Junior Poster
Covinus 21 Junior Poster

sorry cant download here in my office. even if i found the website i wont be able to verify if it was the cpu scheduling program i saw before.

before posting guidelines says:
1. go googling
(if not answered)
2. search daniweb for previous threads
(if not answered)
3. post your problem..

Covinus 21 Junior Poster

i found one program before that does that try googling around i kinda forgot the site.

Im gonna try to make my own progam. Im bored here.

Covinus 21 Junior Poster

Hi everybody,

Do pointers or references exist in Java ?

-Jishnu

no

Covinus 21 Junior Poster

if you want to program in c++ you need a very good foundation.

one design philisophy of c++(wikipedia.org)

C++ is designed to give the programmer choice, even if this makes it possible for the programmer to choose incorrectly

it could get nasty if you jump beginer level to advance if you dont know eg memory management

Covinus 21 Junior Poster

this are the difference between the 2
WIN32,_DEBUG,_WINDOWS,_MBCS - > debug
WIN32,NDEBUG,_WINDOWS,_MBCS -> release

i change my release to _DEBUG,_WINDOWS

no more warnings

Covinus 21 Junior Poster

i cant find any properties in my project menu. is it equivalent to settings?

Covinus 21 Junior Poster

thanks il keep your advice in mind.(the ignoring warning thing)

im using VC++ 6 we have 7 here but my company doesnt want us to use it. dev is high level. too easy for training

Covinus 21 Junior Poster

btw is their a serious problems that could happen if i just ignore the warning?

Covinus 21 Junior Poster

where can i see the properties for both debug and release?

Covinus 21 Junior Poster

warning C4273: 'fileHandle::fileHandle' : inconsistent dll linkage. dllexport assumed.

what does this warning mean? during debug i dont get this message but during release i have this one. can anyone explain the message to me and maybe give some remedy to it

Covinus 21 Junior Poster

he must have translated his own language to english word for word. maybe thats why his post is so impolite.

Covinus 21 Junior Poster

hurry up read the link. whats taking you so long

Covinus 21 Junior Poster

string ABC111="ABC111";

Covinus 21 Junior Poster

Your ABsomething has no value. so when compared to your moduleCode it doesnt match your condition so it loops forever

Covinus 21 Junior Poster

my bad.. hehehe

i forgot to

fr=fopen;

Covinus 21 Junior Poster

can anyone explain about assertion failure. i cant seem ti fix my problem with this error. it comes out when i try to load a file.

here part of the code

BDLL fileHandle::load()
{	
	char fileN[MAX_PATH]="";
	
		OPENFILENAME ofn;
		ZeroMemory(&ofn, sizeof(ofn));
		ofn.lStructSize = sizeof(ofn); 
		
	   	ofn.lpstrFilter = "Bitmap Files (*.bmp)\0*.bmp";
		ofn.lpstrFile = fileN;
		ofn.nMaxFile = MAX_PATH;
		ofn.Flags =OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
		ofn.lpstrDefExt = "bmp";
		
		if(GetOpenFileName(&ofn))
		{
			FILE* fr=0;
			fopen(fileN, "rb");
			if(fr==NULL)
			{
					fclose(fr);
			}
			else
			{

				fread(&bfih.bmfh, sizeof(BITMAPFILEHEADER), 1, fr);
				fread(&bfih.bmih, sizeof(BITMAPINFOHEADER), 1, fr);
				bfih.pix= new PIX[bfih.bmih.biSizeImage/3];
				fread(bfih.pix, bfih.bmih.biSizeImage, 1, fr );
					fclose(fr);
			}
		
		
		}			
						
					
	
	

   return bfih;
};
Covinus 21 Junior Poster

just right click on the toolbar and try to find the box you are looking for.

Covinus 21 Junior Poster

my bitmap is persistent on the window. Thanks a million. now my problem is to rotate it. im gonna do some googling for now. thanks again

Covinus 21 Junior Poster

i transfered my code to OnDraw but nothing comes out

Covinus 21 Junior Poster

i got it. hehehe

Covinus 21 Junior Poster
void CMod7aView::OnPaint() 
{
	CClientDC dc(this);

    
 
 if(hBmp!=NULL)
 {
	 CBitmap bmp;
	 bmp.Attach(hBmp);
 
   CDC bmDC;
   bmDC.CreateCompatibleDC(&dc);
   CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
   BITMAP  bi;
   bmp.GetBitmap(&bi);
   dc.BitBlt(0,0,bi.bmWidth,bi.bmHeight,&bmDC,0,0,SRCCOPY);
   bmDC.SelectObject(pOldbmp);

   

  
}

how do you make your image persistant? everytime iload a bitmap after I move the main window the image disappears.

pls help me.

Covinus 21 Junior Poster

WM_PAINT is in the message queue. but my draw text is ignored. nothing comes out of my window. maybe there are some steps i missed before drawing a text.

Covinus 21 Junior Poster

il read it. but i added that updatewindow thing and still nothing

Covinus 21 Junior Poster
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "mod7a.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

char file[MAX_PATH]="";

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


void CMainFrame::OnFileOpen() 
{

	OPENFILENAME ofn;

	ZeroMemory(&ofn, sizeof(ofn));
	ofn.lStructSize=sizeof(OPENFILENAME);
	ofn.hwndOwner=NULL;
	ofn.lpstrFile=file;
	ofn.lpstrFilter = "Bitmap Files (*.bmp)\0*.bmp";
	ofn.nMaxFile = MAX_PATH;
	ofn.Flags =OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
	ofn.lpstrDefExt = "bmp";
	

	if(GetOpenFileName(&ofn))
	{
		
	
	
	}
	
}





void CMainFrame::OnPaint() 
{
	CPaintDC dc(this); 
	RECT rec={100,100,100,100};
	char* …
Covinus 21 Junior Poster

ok. thanks for the good info

Covinus 21 Junior Poster

whats the reason behind using int main over void main?

in most books ive read they often discourage the use of void main. but offer little info about it

Covinus 21 Junior Poster

i found a function that loads bitmap. and i forgot where i put my code for that particular loading. il try to post it as soon as i can

Covinus 21 Junior Poster

i tried that one 2. but still the bitmap remains null

Covinus 21 Junior Poster
hBitmap = LoadBitmap(NULL, saFileName);

ho come i cant load any bitmap using this function?

hBItmap is always null

Covinus 21 Junior Poster

>Using C functions in C++ programs is bad enough, but using malloc to allocate something, and delete to deallocate spells pure disaster.

hehehe. cant even tell which functions is c or c++.

just started learning c you know. and im using a visual c++. so basically c code are acceptable.