Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Mike Certini

@Mike Certini
About
Posts
39
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Duplicate Function - Linker Error LNK2005
    M Mike Certini

    I have been racking my brain trying to figure out how to resolve a duplicate function error (LNK2005) and have been unsuccessful. I have followed direction on the following link as well: http://msdn.microsoft.com/en-us/library/72zdcz6f(v=VS.80).aspx Attached is a printscreen of where the error occurs. The following are issues I have come across: 1. One thing I noted in the output build report is that after invoking the linker with LINK.exe, one of the linker parameters that prints is /incremental:no, though when I look under Solution Explorer\Properties\Configuration Properties\Linker\General\Enable Incremental Linking the setting is Yes(/Incremental). Is there a setting somewhere that is causing an over-ride of the setting? I have done a build/clean for the project. 2. I have specified under Solution Explorer\Properties\Configuration Properties\Linker\Input\Ignore Specific Library the mfcs90ud.lib file. I added it back as an additional dependency. Though I still have problems with this lib file.

    // MetaDLL_5.cpp : Defines the initialization routines for the DLL.
    //
    #pragma once

    #define WIN32_LEAN_AND_MEAN
    //#define _AFXDLL

    //#include #include "stdafx.h"

    #include "MetaDLL_6.h"
    #using using namespace System;
    using namespace System::Globalization;
    using namespace System::Runtime::InteropServices;
    using System::String;

    #define MT4_EXPFUNC __declspec(dllexport)

    #pragma managed
    String *ansi_to_managed(char *date_time)
    {
    return Marshal::PtrToStringAnsi(date_time);
    }

    #pragma unmanaged
    BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
    {
    return TRUE;
    }

    #pragma managed
    MT4_EXPFUNC void __stdcall gDateTime(char *date_time, int *year, int *month, int *day, int *hour, int *minute, int *second, int *millisecond)
    {

    //String \*myDateTimeValue = ansi\_to\_managed(date\_time);	
    String \*myDateTimeValue	  = S"02/16/1992 12:15:12.253";
    String \*expectedFormats\[\] = {S"MM/dd/yyyy HH:mm:ss.FFF"};
    IFormatProvider\* culture = new CultureInfo(S"en\_US", true);
    DateTime myDateTime = DateTime::ParseExact(myDateTimeValue, expectedFormats, culture, DateTimeStyles::AssumeLocal);
    
    \*year			= myDateTime.Year;
    \*month			= myDateTime.Month;
    \*day			= myDateTime.Day;
    \*hour			= myDateTime.Hour;
    \*minute			= myDateTime.Minute;
    \*second			= myDateTime.Second;
    \*millisecond	= myDateTime.Millisecond;
    }
    
    C / C++ / MFC c++ visual-studio com help tutorial

  • Date / Time Class
    M Mike Certini

    After considerable research I have come up with the following solution which is 95% complete. I though cannot figure out how to report the milliseconds.

    #include #using using namespace System;
    using namespace System::Globalization;
    using System::String;

    int main()
    {
    // Assume the current culture is en-US.
    // The date is Feburary 16, 1992, 12 hours, 15 minutes and 12 seconds and 253 milliseconds.

    String\* myDateTimeValue = S"02/16/1992 12:15:12.253";
    String\* expectedFormats\[\] = {S"MM/dd/yyyy hh:mm:ss.FFF"};
    IFormatProvider\* culture = new CultureInfo(S"en-US", true);
    DateTime myDateTime = DateTime::ParseExact(myDateTimeValue, expectedFormats, culture, DateTimeStyles::AssumeLocal);
    Console::WriteLine(S"1) myDateTime       = {0}", \_\_box(myDateTime));
    
    system("pause");
    }
    
    C / C++ / MFC tools question

  • DateTime::ParseExact
    M Mike Certini

    Can someone help me with the getting my ParseExact working? Though following guidance from MSDN site I am still incorrect with my syntax. The error I am receiving is the following:
    Error C2665: 'System::DateTime::ParseExact' : none of the 3 overloads could convert all the argument types.
    C2665- Error Description: 'function' : none of the number1 overloads can convert parameter number2 from type 'type'

    #include #include #include #include #using using namespace std;
    using namespace System;
    using namespace System::Globalization;
    using namespace System::Collections;

    void main()
    {
    //System::Collections::IEnumerator^ en = CultureInfo::GetCultures(CultureTypes::SpecificCultures)->GetEnumerator();
    //System::Globalization::CultureInfo^ MyCI = gcnew CultureInfo("en-US",false);
    //System::Globalization::DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;

    std::string dateString = "MAY\_03\_2010";
    std::string format = "MMM\_dd\_yyyy";
    //	DateTime dt = DateTime::Now;	
    DateTime dateTime = DateTime::ParseExact(dateString,format,nullptr);
    //System::DateTime dateTimevalue = System::DateTime::ParseExact(dateString,"MMMddyyyy",CultureInfo.InvariantCulture); 
    
    system("pause");
    

    }

    C / C++ / MFC help question

  • Date / Time Class
    M Mike Certini

    loveheronly, Excellent, thank you for your reply. Does the time_t container accomodate milliseconds?

    C / C++ / MFC tools question

  • Date / Time Class
    M Mike Certini

    I need to find the best time class to use with a program that works with a date/time number in the following format: yyyy.mm.dd hh:mm:ss.ms. Essentially, I am reading values from a flat file (CSV) into a variable and then working with the variable. Does anyone out there know the best class to use? I have researched CFileTime and CTime classes. I do not know if functions within are the best for manipulating time. CTime has been ruled out because it does not accomodate milliseconds. Are there other classes I am not aware of? Lastly is there any references (links) showing how the functions are used. The overall application involves exporting the applicable function through a DLL into an MQL4 script.

    C / C++ / MFC tools question

  • Variable In SQL String
    M Mike Certini

    Superman, Excellent! You pointed me in the right direction. After some modifications, the following code works:

    char sSQLCommand[100];
    char TempField[50];
    printf("Input Field");
    scanf("%s",TempField);
    sprintf_s(sSQLCommand,"ALTER TABLE TableIn ADD %s nvarchar(20)",TempField);

    C / C++ / MFC database c++ com

  • Variable In SQL String
    M Mike Certini

    I am trying to insert a variable in a SQL string but am not having any success in finding the proper sytax. I am coding in C++. Listed below is code section I am trying to figure out. This code is part of an ADO routine that adds a field in an Access Database.

    char Value[40];
    printf("Input A String");
    scanf("%s",Value);
    sSQLCommand = L"ALTER TABLE TableIn ADD @Value nvarchar(20)";
    com->CommandText = sSQLCommand;

    Unfortunately what gets added to the database as a field is @Value.

    C / C++ / MFC database c++ com

  • Copying From Single Dimension Array To Multiple Dimension Array
    M Mike Certini

    chevu, Thank you for your reply. I am not taking a class but doing self study to learn C. I will take your solution and walk through the logic to understand. Thanks again. Mike

    C / C++ / MFC c++ data-structures tutorial question

  • Copying From Single Dimension Array To Multiple Dimension Array
    M Mike Certini

    I am currently trying to copy the contents from a single dimension array to a multiple dimension array using pointer notation. I though am having problems doing so. Can someone out there show me how to program a multiple dimension array that will take from a single dimension array? Listed below is sample code that I am trying to get to work. Code: #include <stdio.h> #define SIZE 5 #define SIZE2 5 #define ROWS 2 void transarr4(int *(*(arry)), int * arry2, int row); //Pointer Notation (Multiple Dimension Array) int main(void) { int arr[SIZE] = {100,200,300,400,500}; int arr2[ROWS][SIZE2] = {{},{}}; int *(*(arr3)) = 0; transarr4(arr3,arr,ROWS); //Pointer Notation (Multiple Dimension Array) return 0; } //==================================================================================================== // Pointer Notation (Multi-Dimension Array) //==================================================================================================== void transarr4(int *(*(arry)), int * arry2, int row) { int num = 0; int r = 0; int c = 0; for(r = 0; r < row; r++) { for(c = 0; c < SIZE2; c++) { //arr[r][c] = arr2[c]; *(*(arry)) = arry2[c]; printf("%d",*(*(arry + r)+c)); printf("\n"); } } }

    C / C++ / MFC c++ data-structures tutorial question

  • VS 2008 Configuration For Libraries
    M Mike Certini

    tagopi, This is the solution that was posted by WayneAKing in the Visual C++ Developer Center forum. His posting is in response to an error listing that I posted. This guy knows everything. My program is now working. I added the directory to the project configuration >properties - linker - general tab. That's half the requirements. What did I say to add, and where did I say to add it? Look under Linker->Input for "Additional Dependencies" and add your .lib filename to the list. >int main() You are making a console program. >error LNK2019: unresolved external symbol _WinMain@16 >referenced in function ___tmainCRTStartup WinMain is used with Win32 GUI applications, not console apps. How did you create the project? Which project template did you use? You should have selected "Win32 Console Application". Look under Linker->System for "SubSystem" and set it to "Console (/SUBSYSTEM:CONSOLE)" - Wayne

    C / C++ / MFC visual-studio com help question workspace

  • VS 2008 Configuration For Libraries
    M Mike Certini

    Mike, Thank you for your reply. Where do you add it? I added it to configuration properties\linker\general\additional library directories. I though am now getting LINK2019 for each of the functions. See below: Exercise.obj : error LNK2019: unresolved external symbol "double __cdecl Max(double const *,int)" (?Max@@YANPBNH@Z) referenced in function _main 1>Exercise.obj : error LNK2019: unresolved external symbol "double __cdecl Min(double const *,int)" (?Min@@YANPBNH@Z) referenced in function _main 1>Exercise.obj : error LNK2019: unresolved external symbol "double __cdecl Average(double const *,int)" (?Average@@YANPBNH@Z) referenced in function _main 1>Exercise.obj : error LNK2019: unresolved external symbol "double __cdecl Sum(double const *,int)" (?Sum@@YANPBNH@Z) referenced in function _main 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

    C / C++ / MFC visual-studio com help question workspace

  • VS 2008 Configuration For Libraries
    M Mike Certini

    I just recently tried to create a library and then use the library functions within a simple console application. I followed the instructions at: http://www.functionx.com/visualc/libraries/staticlib.htm After copying the "lib" and "h" file into the source file directory for the program, I got a linking error. I added these files to the project via "Add Existing Item" menu selection. The error I got was the following: A custom build rule to build files with extension 'lib' could not be found. Would you like to create a new rule to define a custom build rule to build files with this extension? I would think that using library functions would be a standard functionality for Visual C. Is there a setting somewhere that has to be adjusted to allow for this functionality? If not, does anyone know the rule that needs to be used? --------------------------------------------------------------------------------

    C / C++ / MFC visual-studio com help question workspace

  • ADO To MS Access Database.
    M Mike Certini

    Mika, Thank you for your response. After making the changes you suggested I get the following error. Instead of the "Records Affected" parameter, I have input "NULL". As a result, I am getting this error: Connection object created. Connection has been opened. Error Code = 80040e14 Code meaning = I Source = Microsoft JET Database Engine Description = Expected query name after EXECUTE.

    Database help database com question

  • ADO To MS Access Database.
    M Mike Certini

    I am having problems with executing a command object in ADO. The specific problem I have revolves around the proper type for the SQL string. Following examples on the internet, I established it with a _bstr_t. This though is not working with the * VARIANT type that is required in the Execute method. Can someone help me with the proper establishment of the SQL string? Listed below is the complete program: Here is my error message coming out of the try block: error C2664: 'ADODB::Command15::Execute' : cannot convert parameter 1 from '_bstr_t' to 'VARIANT *' 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

    #include <stdio.h>
    #include <string>
    using std::string;

    int cyc = 0;

    #import "c:\program files\common files\system\ado\msado15.dll" rename ("EOF","EOFile")
    using namespace std;

    struct StartOLEProcess{
    StartOLEProcess( ) {
    ::CoInitialize(NULL);
    }
    ~StartOLEProcess( ) {
    ::CoUninitialize( );
    }
    } _start_StartOLEProcess;

    void main(void)
    {
    // define our variables which will be used as references to the
    // Connection and Recordset objects

    ADODB::\_ConnectionPtr  con = NULL;
    ADODB::\_RecordsetPtr   rec = NULL;
    ADODB::\_CommandPtr	   com = NULL;
    ADODB::\_ParameterPtr   par = NULL;
     
    // create two strings for use with the creation of a Connection
    // and a Recordset object
    
    bstr\_t                 sConString;
    bstr\_t                 sSQLString;
    
    // create a variable to hold the result to function calls
    
    HRESULT                hr                = S\_OK;
    
    // long variable needed for Execute method of Connection object
    
    VARIANT                \*vRecordsAffected = NULL;
    
    // create instance of an ADO Connection object, ADO Command object, ADO Parameter object, ADO Record object
    
    hr = con.CreateInstance(\_\_uuidof(ADODB::Connection));
    hr = com.CreateInstance(\_\_uuidof(ADODB::Command));
    hr = par.CreateInstance(\_\_uuidof(ADODB::Parameter));
    hr = rec.CreateInstance(\_\_uuidof(ADODB::Record));
    
    printf("Connection object created.\\n");
    
    // open the data source with the Connection object
    
    sConString = L"Provider=Microsoft.Jet.OLEDB.4.0;" 
                 L"Data Source=C:\\\\Users\\\\Mike Certini\\\\Documents\\\\Trading\\\\Databases\\\\TradingAnalysis#2.mdb";
    			 //L"DataSchema=mytable";
    
    // open the connection.
    
    hr = con->Open(sC
    
    Database help database com question

  • Variable In SQL String
    M Mike Certini

    Luc, The error is occuring at VALUES('"+ text + "'). My VS2008 is giving me this error. I am trying to send a record to MS Access.

    Database database data-structures tutorial

  • Variable In SQL String
    M Mike Certini

    Luc, I am getting the error message: "error C2110: '+' : cannot add two pointers"

    Database database data-structures tutorial

  • Variable In SQL String
    M Mike Certini

    Luc, Thank you for your reply.

    Database database data-structures tutorial

  • Variable In SQL String
    M Mike Certini

    I am currently trying to code a variable into a SQL string that is used with ADO to create a record within a database. I though am having problems with the proper syntax for a variable. The string works fine with a number but when I try to code a variable I have problems. I need to find out how to code an array as well.

    hr = rec2->Open("INSERT INTO mytable(id)VALUES("+ text +")",con2.GetInterfacePtr(), ADODB::adOpenForwardOnly, ADODB::adLockReadOnly, ADODB::adCmdText);

    Database database data-structures tutorial

  • Array Issue.
    M Mike Certini

    Posted on different site: You are incrementing cyc unnecessarily in your for loop when you are copying. try this for(cyc = 0; cyc < num;) or a while loop cyc=0; while(cyc < num)

    C / C++ / MFC c++ data-structures help

  • Array Issue.
    M Mike Certini

    I put together a program that takes a list of numbers in an array and sorts them by copying out of the first array into a second array when the value in the first array matches the maximum array element in the first array. What I cannot figure out is why when I look at the array elements saved in the final array there is a skip in element #10 to #11. In other words the second array correctly saves nine 10's and then skips element #10 and then saves the 9's starting in element #11.

    #include <stdio.h>
    #include <stdlib.h>
    #define LIMIT 100

    int roll[100];
    int fin[100];
    int num = 0;

    int main(void)
    {
    int cyc = 0;
    int top = 0;
    int rotate = 0;
    int seek = 0;
    int loop = 0;
    int temp = 0;

    while(num < LIMIT)
    	{
    	roll\[num\] = rand() % 10 + 1;
    	printf("%i",roll\[num\]);
    	printf("\\n");
    	num++;
    	}
    
    for(cyc = 0; cyc < num; cyc++)
    	{
    	if(roll\[loop\] > roll\[loop+1\] && roll\[loop\] > temp)
    		{
    		temp = roll\[loop\];
    		}
    	loop++;
    	}
    
    for(cyc = 0; cyc < num; cyc++)
    	{
    	loop = 0;			        //Zero loop for second number to be evaluated
    	while(loop < num)	                //Go through entire list
    		{
    		if(roll\[loop\] == temp)	        //Evaluate whether item matches maximum number
    			{																			
    			fin\[cyc\] = roll\[loop\];	//Copy item in the first array into the final array.
    			cyc++;			//Increment cycle by 1.
    			}
    		loop++;				//Increment loop to pass through entire list.
    		}
    	temp--;					//Decrement number to be evaluated.	
    	}
    }
    
    C / C++ / MFC c++ data-structures help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups